mirror of
https://github.com/golang/go
synced 2024-11-17 13:04:54 -07:00
cmd/go/testdata/script: move test from test_fuzz to test_fuzz_cache
Tests that require instrumentation must be in a test script which only runs for architectures where coverage is supported. Change-Id: Ia56b1cef1071f848c9dce8c87597207937fdb6c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/354372 Trust: Katie Hockman <katie@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
e38ec96c69
commit
b5cdb1b71c
14
src/cmd/go/testdata/script/test_fuzz.txt
vendored
14
src/cmd/go/testdata/script/test_fuzz.txt
vendored
@ -184,20 +184,6 @@ stdout ok
|
||||
! stdout ^ok
|
||||
stdout FAIL
|
||||
|
||||
|
||||
# Fuzzing indicates that one new interesting value was found with an empty
|
||||
# corpus, and the total size of the cache is now 1.
|
||||
go clean -fuzzcache
|
||||
go test -fuzz=Fuzz -fuzztime=10000x success_fuzz_test.go
|
||||
stdout 'new interesting: 1'
|
||||
stdout 'total: 1'
|
||||
|
||||
# Fuzzing again with a small fuzztime does not find any other interesting
|
||||
# values but still indicates that the cache size is 1.
|
||||
go test -fuzz=Fuzz -fuzztime=2x success_fuzz_test.go
|
||||
stdout 'new interesting: 0'
|
||||
stdout 'total: 1'
|
||||
|
||||
-- noop_fuzz_test.go --
|
||||
package noop_fuzz
|
||||
|
||||
|
17
src/cmd/go/testdata/script/test_fuzz_cache.txt
vendored
17
src/cmd/go/testdata/script/test_fuzz_cache.txt
vendored
@ -32,6 +32,19 @@ go clean -fuzzcache
|
||||
go list -f {{.Stale}} ./empty
|
||||
stdout false
|
||||
|
||||
# Fuzzing indicates that one new interesting value was found with an empty
|
||||
# corpus, and the total size of the cache is now 1.
|
||||
go clean -fuzzcache
|
||||
go test -fuzz=FuzzEmpty -fuzztime=10000x .
|
||||
stdout 'new interesting: 1'
|
||||
stdout 'total: 1'
|
||||
|
||||
# Fuzzing again with a small fuzztime does not find any other interesting
|
||||
# values but still indicates that the cache size is 1.
|
||||
go test -fuzz=FuzzEmpty -fuzztime=2x .
|
||||
stdout 'new interesting: 0'
|
||||
stdout 'total: 1'
|
||||
|
||||
-- go.mod --
|
||||
module example.com/y
|
||||
|
||||
@ -44,6 +57,10 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func FuzzEmpty(f *testing.F) {
|
||||
f.Fuzz(func (*testing.T, []byte) {})
|
||||
}
|
||||
|
||||
func FuzzY(f *testing.F) {
|
||||
f.Add([]byte("y"))
|
||||
f.Fuzz(func(t *testing.T, b []byte) { Y(io.Discard, b) })
|
||||
|
Loading…
Reference in New Issue
Block a user