diff options
| author | Jay Conrod <jayconrod@google.com> | 2021-02-01 18:00:37 -0500 |
|---|---|---|
| committer | Jay Conrod <jayconrod@google.com> | 2021-02-03 19:51:31 +0000 |
| commit | 5ef7357b50015e91b096a4f14f554db78ba18b5f (patch) | |
| tree | bb7c500a3e6bb6f41cc523ede635b009bf32e19e /src/testing/testing.go | |
| parent | 671dba6c89bc0183982553e0359e0a3b2c00963f (diff) | |
| download | go-5ef7357b50015e91b096a4f14f554db78ba18b5f.tar.xz | |
[dev.fuzz] internal/fuzz: refactor CorpusEntry type
CorpusEntry is now a struct type with Name and Data fields. In the
future, it may have more fields describing multiple values with
different types added with f.Add.
CorpusEntry must be the same type in testing and
internal/fuzz. However, we don't want to export it from testing, and
testing can't import internal/fuzz. We define it to be a type alias of
a struct type instead of a defined type. We need to define it to the
same thing in both places. We'll get a type error when building cmd/go
if there's a difference.
Change-Id: I9df6cd7aed67a6aa48b77ffb3a84bd302d2e5d94
Reviewed-on: https://go-review.googlesource.com/c/go/+/288534
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index 39316122a6..e2abec2224 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1361,11 +1361,11 @@ func (f matchStringOnly) ImportPath() string { return " func (f matchStringOnly) StartTestLog(io.Writer) {} func (f matchStringOnly) StopTestLog() error { return errMain } func (f matchStringOnly) SetPanicOnExit0(bool) {} -func (f matchStringOnly) CoordinateFuzzing(time.Duration, int, [][]byte, string, string) error { +func (f matchStringOnly) CoordinateFuzzing(time.Duration, int, []corpusEntry, string, string) error { return errMain } -func (f matchStringOnly) RunFuzzWorker(func([]byte) error) error { return errMain } -func (f matchStringOnly) ReadCorpus(string) ([][]byte, error) { return nil, errMain } +func (f matchStringOnly) RunFuzzWorker(func([]byte) error) error { return errMain } +func (f matchStringOnly) ReadCorpus(string) ([]corpusEntry, error) { return nil, errMain } // Main is an internal function, part of the implementation of the "go test" command. // It was exported because it is cross-package and predates "internal" packages. @@ -1408,9 +1408,9 @@ type testDeps interface { StartTestLog(io.Writer) StopTestLog() error WriteProfileTo(string, io.Writer, int) error - CoordinateFuzzing(time.Duration, int, [][]byte, string, string) error + CoordinateFuzzing(time.Duration, int, []corpusEntry, string, string) error RunFuzzWorker(func([]byte) error) error - ReadCorpus(string) ([][]byte, error) + ReadCorpus(string) ([]corpusEntry, error) } // MainStart is meant for use by tests generated by 'go test'. |
