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: TestScript/mod_install_versioned consistently failing on macOS High Sierra #27221

Closed
shawnps opened this issue Aug 25, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@shawnps
Copy link
Member

commented Aug 25, 2018

What version of Go are you using (go version)?

Go 1.11

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="amd64"
GOHOSTOS="darwin"

What did you do?

Tried installing Go 1.11 from source with

$ cd src
$ ./all.bash

It seems to install, but then TestScript/mod_install_versioned fails, so the tests do not complete:

go test proxy starting
go test proxy running at GOPROXY=http://127.0.0.1:55555/mod
go proxy: no archive w.1 v1.2.0
go proxy: no archive x.1 v1.0.0
go proxy: no archive z.1 v1.2.0
go proxy: no archive rsc.io v1.5.0
go proxy: no archive example.com/unused v0.0.0
go proxy: no archive example.com/unused v0.0.0
go proxy: no archive golang.org/x/text/language 14c0d48
go proxy: no archive golang.org/x/text/language 14c0d48
go proxy: no archive golang.org/x/text/language 14c0d48
go proxy: no archive golang.org/x/text/foo 14c0d48
go proxy: no archive golang.org/x 14c0d48
go proxy: no archive golang.org 14c0d48
go proxy: no archive sub.1 v1.0.0
go proxy: no archive badsub.1 v1.0.0
go proxy: no archive versioned.1 v1.0.0
go proxy: no archive versioned.1 v1.1.0
go proxy: no archive example.com/split/subpkg v1.0.0
--- FAIL: TestScript (0.00s)
    --- FAIL: TestScript/mod_install_versioned (1.63s)
        script_test.go:151: 
            > env GO111MODULE=on
            > go list -f '{{.Target}}' rsc.io/fortune
            [stdout]
            $WORK/gopath/bin/fortune
            [stderr]
            go: finding rsc.io/fortune v1.0.0
            go: downloading rsc.io/fortune v1.0.0
            go: finding rsc.io/quote v1.5.2
            go: downloading rsc.io/quote v1.5.2
            go: finding rsc.io/sampler v1.3.0
            go: finding golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
            go: downloading rsc.io/sampler v1.3.0
            go: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
            > ! stdout fortune@v1
            > stdout 'fortune(\.exe)?$'
            > go list -f '{{.Target}}' rsc.io/fortune/v2
            [stdout]
            $WORK/gopath/bin/fortune
            [stderr]
            go: finding rsc.io/fortune/v2 v2.0.0
            go: downloading rsc.io/fortune/v2 v2.0.0
            > ! stdout v2
            FAIL: testdata/script/mod_install_versioned.txt:8: unexpected match for `v2` found in stdout: v2
            
FAIL
FAIL	cmd/go	198.341s

I can reproduce this by going into src/cmd/go and running go test -run TestScript.

What did you expect to see?

Tests to pass after installing Go 1.11 from source on macOS.

What did you see instead?

TestScript/mod_install_versioned failure.

@ianlancetaylor ianlancetaylor changed the title TestScript/mod_install_versioned consistently failing on macOS High Sierra cmd/go: TestScript/mod_install_versioned consistently failing on macOS High Sierra Aug 25, 2018

@ianlancetaylor ianlancetaylor added this to the Go1.11.1 milestone Aug 25, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2018

What is the value of GOTMPDIR in your environment?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2018

And the TMPDIR environment variable?

@shawnps

This comment has been minimized.

Copy link
Member Author

commented Aug 25, 2018

What is the value of GOTMPDIR in your environment?

GOTMPDIR=""

And the TMPDIR environment variable?

➜  ~  echo $TMPDIR
/var/folders/v2/jznq80057xzfwfpl2msl93pm0000gp/T/
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2018

Thanks. The problem is that TMPDIR contains the string v2, which is causing the regexp to match unexpectedly. That is, the test is verifying that the output does not contain v2, but it does happen to contain v2 when it prints $WORK/gopath/bin/fortune, as $WORK expands to something like /var/folders/v2/jznq80057xzfwfpl2msl93pm0000gp/T/cmd-go-test-12345.

So this is not an actual test failure, but is rather a bug in the test harness that shows up in your environment.

I'll send a fix.

@shawnps

This comment has been minimized.

Copy link
Member Author

commented Aug 25, 2018

That makes sense, thank you @ianlancetaylor.

@gopherbot

This comment has been minimized.

Copy link

commented Aug 25, 2018

Change https://golang.org/cl/131398 mentions this issue: cmd/go: don't let script grep commands match $WORK

@shawnps

This comment has been minimized.

Copy link
Member Author

commented Aug 25, 2018

@ianlancetaylor TestScript now passes with your fix.

@gopherbot gopherbot closed this in f2ed3e1 Aug 25, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Aug 25, 2018

Change https://golang.org/cl/131399 mentions this issue: [release-branch.go1.11] cmd/go: don't let script grep commands match $WORK

gopherbot pushed a commit that referenced this issue Aug 26, 2018

[release-branch.go1.11] cmd/go: don't let script grep commands match …
…$WORK

If $WORK happens to contain the string that a stdout/stderr/grep
command is searching for, a negative grep command will fail incorrectly.

Fixes #27170
Fixes #27221

Change-Id: I84454d3c42360fe3295c7235d388381525eb85b4
Reviewed-on: https://go-review.googlesource.com/131398
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit e3106b455b74c91db94e8e1abf2342b5b5aec7b1)
Reviewed-on: https://go-review.googlesource.com/131399
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.