From: Katie Hockman Date: Tue, 1 Dec 2020 22:37:07 +0000 (-0500) Subject: [dev.fuzz] testing: fix duplicate logging when fuzzing X-Git-Tag: go1.18beta1~1282^2~117 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=db514c0caf5effb4396c9746e025c1ba2d717604;p=gostls13.git [dev.fuzz] testing: fix duplicate logging when fuzzing The workers were printing PASS/FAIL logs and various others things, when that should be the sole responsibility of the coordinator process, which will have the aggregated data. Change-Id: I7ac9883db62f0fe79ba1799cb88773c542a2a948 Reviewed-on: https://go-review.googlesource.com/c/go/+/274652 Trust: Katie Hockman Run-TryBot: Katie Hockman TryBot-Result: Go Bot Reviewed-by: Jay Conrod --- diff --git a/src/testing/fuzz.go b/src/testing/fuzz.go index 100075ca2c..5f65f8a395 100644 --- a/src/testing/fuzz.go +++ b/src/testing/fuzz.go @@ -191,6 +191,9 @@ func (f *F) Fuzz(ff interface{}) { } func (f *F) report() { + if *isFuzzWorker { + return + } if f.Failed() { fmt.Fprintf(f.w, "--- FAIL: %s\n%s\n", f.name, f.result.String()) } else if f.chatty != nil { @@ -357,7 +360,9 @@ func runFuzzing(deps testDeps, fuzzTargets []InternalFuzzTarget) (ran, ok bool) } if Verbose() { f.chatty = newChattyPrinter(f.w) - f.chatty.Updatef(f.name, "--- FUZZ: %s\n", f.name) + if !*isFuzzWorker { + f.chatty.Updatef(f.name, "--- FUZZ: %s\n", f.name) + } } go f.runTarget(target.Fn) <-f.signal diff --git a/src/testing/testing.go b/src/testing/testing.go index f44b7ca7a5..8b4f55215b 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1441,14 +1441,16 @@ func (m *M) Run() (code int) { if *matchFuzz != "" && !fuzzingRan { fmt.Fprintln(os.Stderr, "testing: warning: no targets to fuzz") } - if !fuzzingOk { + if !fuzzingOk && !*isFuzzWorker { fmt.Println("FAIL") m.exitCode = 1 return } - fmt.Println("PASS") m.exitCode = 0 + if !*isFuzzWorker { + fmt.Println("PASS") + } return }