New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: 'go test' adds test.timeout flag after positional arguments #34072
Comments
@gopherbot, please backport to Go 1.13: this is a regression and the fix is trivial. |
Change https://golang.org/cl/193297 mentions this issue: |
Backport issue(s) opened: #34083 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/193269 mentions this issue: |
To run tests with go1.13 add "-timeout 0" to prevent the -test.timeout flag from being appended:
|
…ather than appending Tests may accept positional arguments, in which case the -test.timeout flag must be passed before those arguments. Updates #34072 Fixes #34083 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> (cherry picked from commit d21953d) Reviewed-on: https://go-review.googlesource.com/c/go/+/193269
Tests may accept positional arguments, in which case the -test.timeout flag must be passed before those arguments. Fixes golang#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>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In a module test we have named flags as well as positional arguments. When we run the tests using
go test ... -flag 1 positional
the-test.timeout
is appended resulting ingo test ... -flag 1 positional -test.timeout=10m
. Flags after positional arguments are not parsed anymore which makes-test.timeout=10m
a positional argument as well.What did you expect to see?
The tests should run as in 1.12, no timeout flag specified.
What did you see instead?
The timeout flag
-test.timeout=10m
was not parsed correctly but ends up as a positional argument.Possible fix?
Add the
-test.timeout=10m
flag at the very beginning, making it immune to breaking positional arguments. Updated docs mentioning that behavior would be highly appreciated too. The line causing that behavior is /src/cmd/go/internal/test/test.go.The text was updated successfully, but these errors were encountered: