From: Jay Conrod Date: Thu, 13 May 2021 17:13:26 +0000 (-0400) Subject: [dev.fuzz] cmd/go: fix test_fuzz_cache X-Git-Tag: go1.18beta1~1282^2~55 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bb53bd49571e08909ab6274255ddddd6c6ffe041;p=gostls13.git [dev.fuzz] cmd/go: fix test_fuzz_cache This test started failing when coverage-based fuzzing was enabled. It expects at least one file to be written to the fuzz cache. Nothing was written because the fuzz function was trivial, and no interesting inputs could be discovered. This CL makes the fuzz function return different values for different inputs, which is enough to pass. Change-Id: I6ffd2667891cf5f3e4588133efb65f096a739c09 Reviewed-on: https://go-review.googlesource.com/c/go/+/319871 Trust: Jay Conrod Run-TryBot: Jay Conrod Reviewed-by: Katie Hockman --- diff --git a/src/cmd/go/testdata/script/test_fuzz_cache.txt b/src/cmd/go/testdata/script/test_fuzz_cache.txt index cb344a7158..a6c9cafada 100644 --- a/src/cmd/go/testdata/script/test_fuzz_cache.txt +++ b/src/cmd/go/testdata/script/test_fuzz_cache.txt @@ -39,7 +39,15 @@ import "testing" func FuzzY(f *testing.F) { f.Add([]byte("y")) - f.Fuzz(func(t *testing.T, b []byte) {}) + f.Fuzz(func(t *testing.T, b []byte) { Y(b) }) +} +-- y.go -- +package y + +import "bytes" + +func Y(b []byte) bool { + return bytes.Equal(b, []byte("y")) } -- empty/empty.go -- package empty