aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/test/test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-09-04 12:59:41 -0400
committerBryan C. Mills <bcmills@google.com>2019-09-04 20:38:05 +0000
commitd21953df047868ed3bcfd0172a6c1672642f5b4a (patch)
treec9295bc98cf2d2b36903b744e8731d4f6667af79 /src/cmd/go/internal/test/test.go
parent5ff38e476177ce9e67375bd010bea2e030f2fe19 (diff)
downloadgo-d21953df047868ed3bcfd0172a6c1672642f5b4a.tar.gz
go-d21953df047868ed3bcfd0172a6c1672642f5b4a.zip
cmd/go/internal/test: prepend -test.timeout rather than appending
Tests may accept positional arguments, in which case the -test.timeout flag must be passed before those arguments. Fixes #34072 Change-Id: I5b92d7c0edc4f9e1efb63b0733937b76236c0eff Reviewed-on: https://go-review.googlesource.com/c/go/+/193297 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/go/internal/test/test.go')
-rw-r--r--src/cmd/go/internal/test/test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 95000011d8..8141e31c99 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -572,8 +572,9 @@ func runTest(cmd *base.Command, args []string) {
}
// Pass timeout to tests if it exists.
+ // Prepend rather than appending so that it appears before positional arguments.
if testActualTimeout > 0 {
- testArgs = append(testArgs, "-test.timeout="+testActualTimeout.String())
+ testArgs = append([]string{"-test.timeout=" + testActualTimeout.String()}, testArgs...)
}
// show passing test output (after buffering) with -v flag.