]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/testdata/script: move test from test_fuzz to test_fuzz_cache
authorKatie Hockman <katie@golang.org>
Wed, 6 Oct 2021 19:10:39 +0000 (15:10 -0400)
committerKatie Hockman <katie@golang.org>
Wed, 6 Oct 2021 19:50:24 +0000 (19:50 +0000)
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>
src/cmd/go/testdata/script/test_fuzz.txt
src/cmd/go/testdata/script/test_fuzz_cache.txt

index 0b01c2fb43ece1bb7f76d1ede6401060989fef58..c9930aa37e4bb48eb3f37b1ab800dca63f66b975 100644 (file)
@@ -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
 
index a3fcca887e0bebdc69df08a5933edbb8e41d082a..fc1c9a17525667992c7ff61bb2e644fd8dd1842e 100644 (file)
@@ -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) })