mirror of https://github.com/golang/go.git
[dev.fuzz] internal/fuzz: remove duplicate read from testdata
We already read the seed corpus from testdata for the fuzz target, and pass that corpus to the coordinator. The coordinator doesn't need to read from testdata again. Change-Id: Ia7822e3e02b35d56f6918c7082a7b19901b36644 Reviewed-on: https://go-review.googlesource.com/c/go/+/293189 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>
This commit is contained in:
parent
9cbf92c52b
commit
1c162b41c5
|
|
@ -49,7 +49,7 @@ func CoordinateFuzzing(ctx context.Context, parallel int, seed []CorpusEntry, co
|
|||
}
|
||||
|
||||
sharedMemSize := 100 << 20 // 100 MB
|
||||
corpus, err := readCorpusAndCache(seed, corpusDir, cacheDir)
|
||||
corpus, err := readCache(seed, cacheDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -262,7 +262,7 @@ type coordinator struct {
|
|||
errC chan error
|
||||
}
|
||||
|
||||
// readCorpusAndCache creates a combined corpus from seed values, values in the
|
||||
// readCache creates a combined corpus from seed values, values in the
|
||||
// corpus directory (in testdata), and values in the cache (in GOCACHE/fuzz).
|
||||
//
|
||||
// TODO(jayconrod,katiehockman): if a value in the cache has the wrong type,
|
||||
|
|
@ -270,16 +270,14 @@ type coordinator struct {
|
|||
// the same package at a different version or in a different module.
|
||||
// TODO(jayconrod,katiehockman): need a mechanism that can remove values that
|
||||
// aren't useful anymore, for example, because they have the wrong type.
|
||||
func readCorpusAndCache(seed []CorpusEntry, corpusDir, cacheDir string) (corpus, error) {
|
||||
func readCache(seed []CorpusEntry, cacheDir string) (corpus, error) {
|
||||
var c corpus
|
||||
c.entries = append(c.entries, seed...)
|
||||
for _, dir := range []string{corpusDir, cacheDir} {
|
||||
entries, err := ReadCorpus(dir)
|
||||
if err != nil {
|
||||
return corpus{}, err
|
||||
}
|
||||
c.entries = append(c.entries, entries...)
|
||||
entries, err := ReadCorpus(cacheDir)
|
||||
if err != nil {
|
||||
return corpus{}, err
|
||||
}
|
||||
c.entries = append(c.entries, entries...)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue