]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.fuzz] testing: remove testing.RunFuzzTargets
authorKatie Hockman <katie@golang.org>
Wed, 14 Oct 2020 16:05:13 +0000 (12:05 -0400)
committerFilippo Valsorda <filippo@golang.org>
Fri, 4 Dec 2020 18:17:29 +0000 (19:17 +0100)
It is a legacy practice to expose these exported
testing functions, and is not needed for running
fuzz targets.

Change-Id: Ic300c9bfd15f4e71a1cea99f12c97d671a899f9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/262258
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/testing/fuzz.go
src/testing/fuzz_test.go [deleted file]

index 6773b7161d8aa2b08b4607b4ef9f78465933c4fe..766242f75d907de39cf18a9b741ef736372cff4e 100644 (file)
@@ -256,13 +256,6 @@ type fuzzContext struct {
        runFuzzWorker     func(func([]byte) error) error
 }
 
-// RunFuzzTargets is an internal function but exported because it is cross-package;
-// it is part of the implementation of the "go test" command.
-func RunFuzzTargets(matchString func(pat, str string) (bool, error), fuzzTargets []InternalFuzzTarget) (ok bool) {
-       _, ok = runFuzzTargets(matchString, fuzzTargets)
-       return ok
-}
-
 // runFuzzTargets runs the fuzz targets matching the pattern for -run. This will
 // only run the f.Fuzz function for each seed corpus without using the fuzzing
 // engine to generate or mutate inputs.
diff --git a/src/testing/fuzz_test.go b/src/testing/fuzz_test.go
deleted file mode 100644 (file)
index 77a7d5e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package testing_test
-
-import (
-       "testing"
-)
-
-func TestFuzzAdd(t *testing.T) {
-       matchFunc := func(a, b string) (bool, error) { return true, nil }
-       tests := []struct {
-               name string
-               fn   func(f *testing.F)
-               ok   bool
-       }{
-               {
-                       "empty",
-                       func(f *testing.F) { f.Add() },
-                       false,
-               },
-               {
-                       "multiple arguments",
-                       func(f *testing.F) { f.Add([]byte("hello"), []byte("bye")) },
-                       false,
-               },
-               {
-                       "string",
-                       func(f *testing.F) { f.Add("hello") },
-                       false,
-               },
-               {
-                       "bytes",
-                       func(f *testing.F) { f.Add([]byte("hello")) },
-                       true,
-               },
-       }
-       for _, tc := range tests {
-               t.Run(tc.name, func(t *testing.T) {
-                       if got, want := testing.RunFuzzTargets(matchFunc, []testing.InternalFuzzTarget{{Fn: tc.fn}}), tc.ok; got != want {
-                               t.Errorf("testing.Add: ok %t, want %t", got, want)
-                       }
-               })
-       }
-}