mirror of
https://github.com/golang/go
synced 2024-11-17 13:54:46 -07:00
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>
This commit is contained in:
parent
b2ff3e82ba
commit
965b114754
@ -509,7 +509,7 @@ var depsRules = `
|
||||
FMT, flag, runtime/debug, runtime/trace, internal/sysinfo, math/rand
|
||||
< testing;
|
||||
|
||||
FMT, crypto/sha256, encoding/json, go/ast, go/parser, go/token, math/rand, encoding/hex, crypto/sha256, log
|
||||
FMT, crypto/sha256, encoding/json, go/ast, go/parser, go/token, math/rand, encoding/hex, crypto/sha256
|
||||
< internal/fuzz;
|
||||
|
||||
internal/fuzz, internal/testlog, runtime/pprof, regexp
|
||||
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user