From 5a4ba6d90543fc1af8822e4f4d379135cef25655 Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Fri, 6 May 2022 10:15:49 -0700 Subject: [PATCH] cmd/go: make TestScript/test_fuzz_minimize_dirty_cov use less memory The test doesn't need to be as aggressive, it _should_ still tickle the right paths with high enough probability. This should significantly reduce the memory it consumes, which is at a premium when testing fuzzing things. Fixes #52744 Change-Id: I4d8dd5b29e65fb429962850b3f4477982452c856 Reviewed-on: https://go-review.googlesource.com/c/go/+/404634 TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills Run-TryBot: Bryan Mills --- .../go/testdata/script/test_fuzz_minimize_dirty_cov.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/go/testdata/script/test_fuzz_minimize_dirty_cov.txt b/src/cmd/go/testdata/script/test_fuzz_minimize_dirty_cov.txt index 571bf752d0..1279f6e9ac 100644 --- a/src/cmd/go/testdata/script/test_fuzz_minimize_dirty_cov.txt +++ b/src/cmd/go/testdata/script/test_fuzz_minimize_dirty_cov.txt @@ -10,8 +10,8 @@ [!fuzz-instrumented] skip env GOCACHE=$WORK/gocache -go test -fuzz=FuzzCovMin -fuzztime=25s -test.fuzzcachedir=$GOCACHE/fuzz -go run check_file/main.go $GOCACHE/fuzz/FuzzCovMin abcd +go test -fuzz=FuzzCovMin -fuzztime=500000x -test.fuzzcachedir=$GOCACHE/fuzz +go run check_file/main.go $GOCACHE/fuzz/FuzzCovMin ab -- go.mod -- module test @@ -22,8 +22,9 @@ package covmin import "testing" func FuzzCovMin(f *testing.F) { + f.Add([]byte("aa")) f.Fuzz(func(t *testing.T, data []byte) { - if len(data) >= 4 && data[0] == 'a' && data[1] == 'b' && data[2] == 'c' && data[3] == 'd' { + if len(data) == 2 && data[0] == 'a' && data[1] == 'b' { return } }) -- 2.51.0