]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.fuzz] cmd/go/internal/test: don't set default timeout when fuzzing
authorKatie Hockman <katie@golang.org>
Fri, 23 Apr 2021 18:06:51 +0000 (14:06 -0400)
committerKatie Hockman <katie@golang.org>
Tue, 4 May 2021 17:19:15 +0000 (17:19 +0000)
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>
src/cmd/go/internal/test/test.go

index c713394141e013922692b7375d0c74acc31cd235..6c92c35360378bd2b3d2320459354c8cfd978dd2 100644 (file)
@@ -618,7 +618,9 @@ func runTest(ctx context.Context, cmd *base.Command, args []string) {
        // 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
        }