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/compile/internal/gc: TestDeps can easily test incorrect version of go binary #34041

Closed
dmitshur opened this issue Sep 3, 2019 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Sep 3, 2019

$ go test cmd/compile/internal/gc
--- FAIL: TestDeps (1.24s)
    dep_test.go:23: undesired dependency on "go/build"
    dep_test.go:23: undesired dependency on "go/token"
FAIL
FAIL	cmd/compile/internal/gc	40.383s

I noticed this on the current release-branch.go1.13 branch, but it might be a problem on master too.

/cc @andybons

I don't know how serious of a problem this is, we should find who has more context on this test. It's new to 1.13.

@dmitshur dmitshur added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 3, 2019
@dmitshur
Copy link
Contributor Author

dmitshur commented Sep 3, 2019

Test was added in CL 172997 to fix issue #31563. /cc @josharian @bradfitz

It seems like a very minor optimization, so not a release blocker.

Additionally, this might be a false positive. The test runs exec.Command("go", ...), which I suspect picked up Go 1.12.9 in my PATH instead of the release-branch.go1.13 version I was running tests on.

@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Sep 3, 2019
@dmitshur
Copy link
Contributor Author

dmitshur commented Sep 3, 2019

It was a false positive. The test needs to be improved.

I can reproduce on master branch:

$ ./make.bash
[...]
$ ../bin/go version
go version devel +3c56143442 Tue Sep 3 17:10:37 2019 +0000 darwin/amd64
$ ../bin/go test cmd/compile/internal/gc
--- FAIL: TestDeps (0.16s)
    dep_test.go:23: undesired dependency on "go/build"
    dep_test.go:23: undesired dependency on "go/token"
FAIL
FAIL	cmd/compile/internal/gc	9.685s
FAIL
$ go version
go version go1.12.9 darwin/amd64
$ PATH="$(pwd)/../bin:$PATH" go version
go version devel +3c56143442 Tue Sep 3 17:10:37 2019 +0000 darwin/amd64
$ PATH="$(pwd)/../bin:$PATH" go test cmd/compile/internal/gc
ok  	cmd/compile/internal/gc	7.000s

@dmitshur dmitshur added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. labels Sep 3, 2019
@dmitshur dmitshur added this to the Go1.14 milestone Sep 3, 2019
@dmitshur dmitshur removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 3, 2019
@dmitshur dmitshur changed the title cmd/compile/internal/gc: TestDeps failing cmd/compile/internal/gc: TestDeps can easily test incorrect version of go binary Sep 3, 2019
@dmitshur
Copy link
Contributor Author

dmitshur commented Sep 3, 2019

/cc @hajimehoshi FYI.

@gopherbot
Copy link

Change https://golang.org/cl/193077 mentions this issue: cmd/compile/internal/gc: use GoToolPath in TestDeps

t4n6a1ka pushed a commit to t4n6a1ka/go that referenced this issue Sep 5, 2019
Updates golang#31563
Fixes golang#34041

Change-Id: Ib9fdcd2f83d867fd31b42eab3a813f5cef88860e
Reviewed-on: https://go-review.googlesource.com/c/go/+/193077
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@golang golang locked and limited conversation to collaborators Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

3 participants