diff options
| author | Jay Conrod <jayconrod@google.com> | 2021-04-02 14:36:08 -0400 |
|---|---|---|
| committer | Jay Conrod <jayconrod@google.com> | 2021-04-09 19:51:56 +0000 |
| commit | 4baa39ca22c34d4c224ac69da644c85dee196474 (patch) | |
| tree | 7283ef3bb94f43a91e2a5cc297467e9d9e13d8d8 /src/testing/testing.go | |
| parent | 4cde035a720448b2bca07ecdc12beef3b1322939 (diff) | |
| download | go-4baa39ca22c34d4c224ac69da644c85dee196474.tar.xz | |
[dev.fuzz] testing: let -fuzztime specify a number of executions
-fuzztime now works similarly to -benchtime: if it's given a string
with an "x" suffix (as opposed to "s" or some other unit of
duration), the fuzzing system will generate and run a maximum number
of values.
This CL also implements tracking and printing counts, since most of
the work was already done.
Change-Id: I013007984b5adfc1a751c379dc98c8d46b4a97e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/306909
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index 2ba93ad63d..48e9ee089f 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1326,7 +1326,7 @@ func (f matchStringOnly) ImportPath() string { return " func (f matchStringOnly) StartTestLog(io.Writer) {} func (f matchStringOnly) StopTestLog() error { return errMain } func (f matchStringOnly) SetPanicOnExit0(bool) {} -func (f matchStringOnly) CoordinateFuzzing(time.Duration, int, []corpusEntry, []reflect.Type, string, string) error { +func (f matchStringOnly) CoordinateFuzzing(time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error { return errMain } func (f matchStringOnly) RunFuzzWorker(func(corpusEntry) error) error { return errMain } @@ -1375,7 +1375,7 @@ type testDeps interface { StartTestLog(io.Writer) StopTestLog() error WriteProfileTo(string, io.Writer, int) error - CoordinateFuzzing(time.Duration, int, []corpusEntry, []reflect.Type, string, string) error + CoordinateFuzzing(time.Duration, int64, int, []corpusEntry, []reflect.Type, string, string) error RunFuzzWorker(func(corpusEntry) error) error ReadCorpus(string, []reflect.Type) ([]corpusEntry, error) } @@ -1417,12 +1417,6 @@ func (m *M) Run() (code int) { m.exitCode = 2 return } - if *fuzzDuration < 0 { - fmt.Fprintln(os.Stderr, "testing: -fuzztime can only be given a positive duration, or zero to run indefinitely") - flag.Usage() - m.exitCode = 2 - return - } if *matchFuzz != "" && *fuzzCacheDir == "" { fmt.Fprintln(os.Stderr, "testing: internal error: -test.fuzzcachedir must be set if -test.fuzz is set") flag.Usage() |
