The -timeout flag is not used when the fuzzing engine
is running, but there was another backup alarm that would
stop the test binary after 11 minutes by default. This
change disables that backup alarm when the -fuzz flag is
set.
Note: unfortunately this means that if someone is running
`go test -fuzz` and a test hangs before the fuzzing engine
starts running, then the backup alarm won't trigger and
the test will run ~forever. I don't think there's a way
around this though, since the backup alarm has no way of
knowing what stage of the test execution we're in (ie.
are we running the unit tests, the seed corpus, or is
it fuzzing).
Fixes #44483
Change-Id: I4e212708a739c9cfc2e138440e27f257bb408c7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/313072
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>
// to that timeout plus one minute. This is a backup alarm in case
// the test wedges with a goroutine spinning and its background
// timer does not get a chance to fire.
- if testTimeout > 0 {
+ // Don't set this if fuzzing, since it should be able to run
+ // indefinitely.
+ if testTimeout > 0 && testFuzz == "" {
testKillTimeout = testTimeout + 1*time.Minute
}