diff options
| author | Katie Hockman <katie@golang.org> | 2021-01-15 11:26:34 -0500 |
|---|---|---|
| committer | Katie Hockman <katie@golang.org> | 2021-01-15 17:05:30 +0000 |
| commit | d45df5de32e555a0386b7e473d30516d744df70a (patch) | |
| tree | 42efeb5cd25e16d8f0e4993bac3dfd65beb66793 /src | |
| parent | cc7f8c305501399c78d894b7ba7bd3ea428b250e (diff) | |
| download | go-d45df5de32e555a0386b7e473d30516d744df70a.tar.xz | |
[dev.fuzz] cmd/go/testdata: fix flaky test
Change-Id: I7702aa12a1ed9bb0645af774dd584e661d7c8fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/284193
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/go/testdata/script/test_fuzz_mutator.txt | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/cmd/go/testdata/script/test_fuzz_mutator.txt b/src/cmd/go/testdata/script/test_fuzz_mutator.txt index f858dcf354..bc7edf3cc5 100644 --- a/src/cmd/go/testdata/script/test_fuzz_mutator.txt +++ b/src/cmd/go/testdata/script/test_fuzz_mutator.txt @@ -14,7 +14,7 @@ go run check_logs.go fuzz fuzz.worker ! go test -v -fuzz=Fuzz -parallel=1 -fuzztime=30s mutator_test.go ! stdout ok stdout FAIL -stdout 'mutator found enough edge cases' +stdout 'mutator found enough unique mutations' -- go.mod -- module m @@ -162,7 +162,6 @@ func checkWorkerLog(r io.Reader) error { package fuzz_test import ( - "strings" "testing" ) @@ -175,22 +174,9 @@ func Fuzz(f *testing.F) { crashes := make(map[string]bool) // No seed corpus initiated f.Fuzz(func(t *testing.T, b []byte) { - if len(crashes) >= 150 { - panic("mutator found enough edge cases") - } - - if len(b) < 5 { - return // continue - } - - for i := 0; i < 256; i++ { - s := string(byte(i)) - if strings.HasPrefix(string(b), s) { - crashes["pre-" + s] = true - } - if strings.HasSuffix(string(b), s) { - crashes["suffix-" + s] = true - } + crashes[string(b)] = true + if len(crashes) >= 1000 { + panic("mutator found enough unique mutations") } }) }
\ No newline at end of file |
