]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.fuzz] testing: fix duplicate logging when fuzzing
authorKatie Hockman <katie@golang.org>
Tue, 1 Dec 2020 22:37:07 +0000 (17:37 -0500)
committerFilippo Valsorda <filippo@golang.org>
Fri, 4 Dec 2020 18:17:29 +0000 (19:17 +0100)
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 <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/testing/fuzz.go
src/testing/testing.go

index 100075ca2c916f6f93465dd9aa80eca02858eca5..5f65f8a3958ea29b08b79fa029ecad224889d3ad 100644 (file)
@@ -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
index f44b7ca7a5d45384ec9a9a9363c0a9cf579d6c0e..8b4f55215b934e6020bc730e4e6f96b21548073d 100644 (file)
@@ -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
 }