diff options
| author | Roland Shoemaker <roland@golang.org> | 2021-06-07 17:25:21 -0700 |
|---|---|---|
| committer | Roland Shoemaker <roland@golang.org> | 2021-06-08 20:46:17 +0000 |
| commit | 965b1147549ef28a407bd4e8f5efe5e7b7616f80 (patch) | |
| tree | 0eae3e956a27570f2d396f2d8b6ee8a72bc3407f /src/internal/fuzz/fuzz.go | |
| parent | b2ff3e82ba04f86c724b179d0c0d383da9767243 (diff) | |
| download | go-965b1147549ef28a407bd4e8f5efe5e7b7616f80.tar.xz | |
internal/fuzz: use consistent log format
Match the existing "fuzzing, ..." logging style for debug logs, so that
processing everything is considerably simpler.
Change-Id: I4da4071700b3d9f8fb1ebf0c2de91ac693fd492f
Reviewed-on: https://go-review.googlesource.com/c/go/+/325876
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/internal/fuzz/fuzz.go')
| -rw-r--r-- | src/internal/fuzz/fuzz.go | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/src/internal/fuzz/fuzz.go b/src/internal/fuzz/fuzz.go index 572a0f04d2..929f78bb17 100644 --- a/src/internal/fuzz/fuzz.go +++ b/src/internal/fuzz/fuzz.go @@ -14,7 +14,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "os" "path/filepath" "reflect" @@ -240,7 +239,16 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err } } if printDebugInfo() { - log.Printf("DEBUG new crasher, id: %s, parent: %s, gen: %d, size: %d, exec time: %s\n", result.entry.Name, result.entry.Parent, result.entry.Generation, len(result.entry.Data), result.entryDuration) + fmt.Fprintf( + c.opts.Log, + "DEBUG new crasher, elapsed: %s, id: %s, parent: %s, gen: %d, size: %d, exec time: %s\n", + time.Since(c.startTime), + result.entry.Name, + result.entry.Parent, + result.entry.Generation, + len(result.entry.Data), + result.entryDuration, + ) } stop(err) } @@ -263,12 +271,31 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err } } if printDebugInfo() { - log.Printf("DEBUG new interesting input, id: %s, parent: %s, gen: %d, new edges: %d, total edges: %d, size: %d, exec time: %s\n", result.entry.Name, result.entry.Parent, result.entry.Generation, newEdges, countEdges(c.coverageData), len(result.entry.Data), result.entryDuration) + fmt.Fprintf( + c.opts.Log, + "DEBUG new interesting input, elapsed: %s, id: %s, parent: %s, gen: %d, new edges: %d, total edges: %d, size: %d, exec time: %s\n", + time.Since(c.startTime), + result.entry.Name, + result.entry.Parent, + result.entry.Generation, + newEdges, + countEdges(c.coverageData), + len(result.entry.Data), + result.entryDuration, + ) } } else if c.coverageOnlyRun() { c.covOnlyInputs-- if printDebugInfo() { - log.Printf("DEBUG processed an initial input, id: %s, new edges: %d, size: %d, exec time: %s\n", result.entry.Parent, newEdges, len(result.entry.Data), result.entryDuration) + fmt.Fprintf( + c.opts.Log, + "DEBUG processed an initial input, elapsed: %s, id: %s, new edges: %d, size: %d, exec time: %s\n", + time.Since(c.startTime), + result.entry.Parent, + newEdges, + len(result.entry.Data), + result.entryDuration, + ) } if c.covOnlyInputs == 0 { // The coordinator has finished getting a baseline for @@ -277,12 +304,24 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err // to 0). c.interestingCount = 0 if printDebugInfo() { - log.Printf("DEBUG finished processing input corpus, entries: %d, initial coverage edges: %d\n", len(c.corpus.entries), countEdges(c.coverageData)) + fmt.Fprintf( + c.opts.Log, + "DEBUG finished processing input corpus, elapsed: %s, entries: %d, initial coverage edges: %d\n", + time.Since(c.startTime), + len(c.corpus.entries), + countEdges(c.coverageData), + ) } } } else { if printDebugInfo() { - log.Printf("DEBUG worker reported interesting input that doesn't expand coverage, id: %s, parent: %s\n", result.entry.Name, result.entry.Parent) + fmt.Fprintf( + c.opts.Log, + "DEBUG worker reported interesting input that doesn't expand coverage, elapsed: %s, id: %s, parent: %s\n", + time.Since(c.startTime), + result.entry.Name, + result.entry.Parent, + ) } } } |
