diff options
author | Katie Hockman <katie@golang.org> | 2021-09-10 13:16:32 -0400 |
---|---|---|
committer | Katie Hockman <katie@golang.org> | 2021-09-10 17:46:52 +0000 |
commit | 363f2f3df99f3edd15609cc6bea2a2c6f423ce2c (patch) | |
tree | 106be5f66f91314d08dc9eaea3391bc3ed06adac /src/testing | |
parent | b38e853d04ffc00732474e2e90ffad24f5c6a462 (diff) | |
download | go-363f2f3df99f3edd15609cc6bea2a2c6f423ce2c.tar.gz go-363f2f3df99f3edd15609cc6bea2a2c6f423ce2c.zip |
[dev.fuzz] testing: allow -fuzzminimizetime to be 0
Fixes golang/go#48321
Change-Id: I1547379eb7a703f7f3c4594d27833eb3587796a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/349089
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/benchmark.go | 9 | ||||
-rw-r--r-- | src/testing/fuzz.go | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go index c8571a5f5a..30fa106dd4 100644 --- a/src/testing/benchmark.go +++ b/src/testing/benchmark.go @@ -36,8 +36,9 @@ var ( ) type durationOrCountFlag struct { - d time.Duration - n int + d time.Duration + n int + allowZero bool } func (f *durationOrCountFlag) String() string { @@ -50,14 +51,14 @@ func (f *durationOrCountFlag) String() string { func (f *durationOrCountFlag) Set(s string) error { if strings.HasSuffix(s, "x") { n, err := strconv.ParseInt(s[:len(s)-1], 10, 0) - if err != nil || n <= 0 { + if err != nil || n < 0 || (!f.allowZero && n == 0) { return fmt.Errorf("invalid count") } *f = durationOrCountFlag{n: int(n)} return nil } d, err := time.ParseDuration(s) - if err != nil || d <= 0 { + if err != nil || d < 0 || (!f.allowZero && d == 0) { return fmt.Errorf("invalid duration") } *f = durationOrCountFlag{d: d} diff --git a/src/testing/fuzz.go b/src/testing/fuzz.go index 975aa87eab..d94ec35dc7 100644 --- a/src/testing/fuzz.go +++ b/src/testing/fuzz.go @@ -28,7 +28,7 @@ func initFuzzFlags() { var ( matchFuzz *string fuzzDuration durationOrCountFlag - minimizeDuration = durationOrCountFlag{d: 60 * time.Second} + minimizeDuration = durationOrCountFlag{d: 60 * time.Second, allowZero: true} fuzzCacheDir *string isFuzzWorker *bool |