mirror of https://github.com/golang/go.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 <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Katie Hockman <katie@golang.org>
This commit is contained in:
parent
ad24be022b
commit
bb53bd4957
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue