From 8fabdcee8ff0537097ae68619ff515563bb2f986 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Fri, 2 Oct 2020 16:05:33 -0400 Subject: [dev.fuzz] internal/fuzz: coordinate fuzzing across workers Package fuzz provides common fuzzing functionality for tests built with "go test" and for programs that use fuzzing functionality in the testing package. Change-Id: I3901c6a993a9adb8a93733ae1838b86dd78c7036 Reviewed-on: https://go-review.googlesource.com/c/go/+/259259 Run-TryBot: Jay Conrod TryBot-Result: Go Bot Reviewed-by: Katie Hockman Trust: Katie Hockman Trust: Jay Conrod --- src/testing/testing.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/testing/testing.go') diff --git a/src/testing/testing.go b/src/testing/testing.go index 7cf3323d51..2c2e77dc4b 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1324,6 +1324,8 @@ 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(int, [][]byte) error { return errMain } +func (f matchStringOnly) RunFuzzWorker(func([]byte) error) error { return 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. @@ -1366,6 +1368,8 @@ type testDeps interface { StartTestLog(io.Writer) StopTestLog() error WriteProfileTo(string, io.Writer, int) error + CoordinateFuzzing(int, [][]byte) error + RunFuzzWorker(func([]byte) error) error } // MainStart is meant for use by tests generated by 'go test'. @@ -1431,7 +1435,7 @@ func (m *M) Run() (code int) { return } - fuzzingRan, fuzzingOk := runFuzzing(m.deps.MatchString, m.fuzzTargets) + fuzzingRan, fuzzingOk := runFuzzing(m.deps, m.fuzzTargets) if *matchFuzz != "" && !fuzzingRan { fmt.Fprintln(os.Stderr, "testing: warning: no targets to fuzz") } -- cgit v1.3