aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist/test.go
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2023-07-20 10:23:47 -0400
committerGopher Robot <gobot@golang.org>2023-07-21 14:41:57 +0000
commitc6b5dce0d1ef35c1c35ab14f3e32ad55d7f83818 (patch)
treeffaf278de20c0c235593c7b286908e10ca6f3ae7 /src/cmd/dist/test.go
parentc3da3bcd8ed7b9024ac9e753a0bbd055e009e5e8 (diff)
downloadgo-c6b5dce0d1ef35c1c35ab14f3e32ad55d7f83818.tar.gz
go-c6b5dce0d1ef35c1c35ab14f3e32ad55d7f83818.zip
cmd/dist: apply timeout scale even if timeout isn't overridden
The timeout field is documented as being available so that it's possible to override timeout by setting a non-zero value. If it's left at zero, we don't need to override the default go test timeout, but we still need to apply the timeout scale whenever it's something other than 1. Fixes (via backport) #61468. Change-Id: I63634e9b3ef8c4ec7f334b5a6b4bf3cad121355c Reviewed-on: https://go-review.googlesource.com/c/go/+/511567 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/cmd/dist/test.go')
-rw-r--r--src/cmd/dist/test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index bd02149c11..554adea1b1 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -405,6 +405,9 @@ func (opts *goTest) buildArgs(t *tester) (build, run, pkgs, testFlags []string,
if opts.timeout != 0 {
d := opts.timeout * time.Duration(t.timeoutScale)
run = append(run, "-timeout="+d.String())
+ } else if t.timeoutScale != 1 {
+ const goTestDefaultTimeout = 10 * time.Minute // Default value of go test -timeout flag.
+ run = append(run, "-timeout="+(goTestDefaultTimeout*time.Duration(t.timeoutScale)).String())
}
if opts.short || t.short {
run = append(run, "-short")