Skip to content
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: repeating packages for "go test" is racy #13005

Closed
tv42 opened this issue Oct 21, 2015 · 5 comments
Closed

cmd/go: repeating packages for "go test" is racy #13005

tv42 opened this issue Oct 21, 2015 · 5 comments
Milestone

Comments

@tv42
Copy link

tv42 commented Oct 21, 2015

I accidentally typoed go test . ./... in a build script and noticed an interesting trap: the first . may be executing tests while the second . from ./... tries to open the same executable for writing, leading into a "text file is busy" message, if the timing is just right.

I would have expected either different temp file names, or go test to only run test for a package once, even if it was listed twice.

It was pointed out to me that go test fmt fmt fmt already runs the fmt tests just once, so this probably is about the ... logic not participating in the uniquify.

@tv42
Copy link
Author

tv42 commented Oct 21, 2015

[0 tv@brute ~/go/src/bazil.org/bazil/kv]$ go test . ./...
fork/exec /home/tv/tmp/go-build973088303/bazil.org/bazil/kv/_test/kv.test: text file busy
FAIL    bazil.org/bazil/kv  0.001s
fork/exec /home/tv/tmp/go-build973088303/bazil.org/bazil/kv/_test/kv.test: no such file or directory
FAIL    bazil.org/bazil/kv  0.001s
ok      bazil.org/bazil/kv/kvfiles  0.002s
?       bazil.org/bazil/kv/kvmock   [no test files]
ok      bazil.org/bazil/kv/kvmulti  0.002s
?       bazil.org/bazil/kv/kvpeer   [no test files]
ok      bazil.org/bazil/kv/untrusted    0.004s

@adg
Copy link
Contributor

adg commented Oct 21, 2015

Interesting find. I think the go command should normalize the list of input packages before doing anything.

@adg adg added this to the Go1.6 milestone Oct 21, 2015
@adg adg removed the help wanted label Oct 21, 2015
@nodirt
Copy link
Contributor

nodirt commented Oct 21, 2015

Fixed by CL 16136

@adg adg closed this as completed Oct 21, 2015
@adg
Copy link
Contributor

adg commented Oct 21, 2015

Thanks @nodirt! Sorry I forgot to ask you to add the "Fixes #13005" line to the change description.

@nodirt
Copy link
Contributor

nodirt commented Oct 21, 2015

I forgot to add it :)

On Tue, Oct 20, 2015, 11:57 PM Andrew Gerrand notifications@github.com
wrote:

Thanks @nodirt https://github.com/nodirt! Sorry I forgot to ask you to
add the "Fixes #13005 #13005" line
to the change description.


Reply to this email directly or view it on GitHub
#13005 (comment).

@golang golang locked and limited conversation to collaborators Oct 24, 2016
@rsc rsc unassigned nodirt Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants