-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go/internal/test: pass default timeout to test programs if not gi…
…ven from command line Make 'go test' command to pass the default timeout (10m) to test programs if the value is not given from command line. Fixes #28147 Change-Id: I7856e452224a51a92da03bab8e3a0f9d7c41d32a GitHub-Last-Rev: 66f9a6f GitHub-Pull-Request: #30545 Reviewed-on: https://go-review.googlesource.com/c/go/+/164963 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
- Loading branch information
1 parent
c40bffd
commit ee64b35
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
env GO111MODULE=off | ||
cd a | ||
|
||
# No timeout is passed via 'go test' command. | ||
go test -v | ||
stdout '10m0s' | ||
|
||
# Timeout is passed via 'go test' command. | ||
go test -v -timeout 30m | ||
stdout '30m0s' | ||
|
||
-- a/timeout_test.go -- | ||
package t | ||
import ( | ||
"flag" | ||
"fmt" | ||
"testing" | ||
) | ||
func TestTimeout(t *testing.T) { | ||
fmt.Println(flag.Lookup("test.timeout").Value.String()) | ||
} |