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

runtime: External tests not run with the correct compiler #16577

Closed
quentinmit opened this issue Aug 2, 2016 · 4 comments
Closed

runtime: External tests not run with the correct compiler #16577

quentinmit opened this issue Aug 2, 2016 · 4 comments

Comments

@quentinmit
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go 1.7rc4
  2. What did you do?

$ cd go/
$ ./src/make.bash
$ ./bin/go test -short runtime

  1. What did you expect to see?
    Tests run with ./bin/go
  2. What did you see instead?
    Tests run with the first "go" in $PATH (in this case, the "go" on $PATH was broken, so the tests failed.)
@quentinmit quentinmit added this to the Go1.8Maybe milestone Aug 2, 2016
@randall77
Copy link
Contributor

I've run into this before as well. Recursive calls to "go build" from tests use the go from your path, not the go that was used to run "go test". There are two workarounds: use all.bash, or set up GOROOT/PATH with the directory you're running in.

I don't see any obvious fix. All these tests call testenv.MustHaveGoBuild(t) or variants, maybe we could have them return the right path to use?

@bradfitz
Copy link
Contributor

bradfitz commented Aug 2, 2016

There's already this in testenv:

// GoToolPath reports the path to the Go tool.
// If the tool is unavailable GoToolPath calls t.Skip.
// If the tool should be available and isn't, GoToolPath calls t.Fatal.
func GoToolPath(t *testing.T) string {
        MustHaveGoBuild(t)

There's probably stuff not using it.

@randall77
Copy link
Contributor

Excellent, that's new to me. We should use GoToolPath instead of the MustHaveGoBuild + "go" combo.
Same for MustHaveGoRun, I guess.

@gopherbot
Copy link

CL https://golang.org/cl/28089 mentions this issue.

@golang golang locked and limited conversation to collaborators Aug 30, 2017
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