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/build_trimpath_goroot fails during the release process #52236

Closed
heschi opened this issue Apr 8, 2022 · 5 comments
Closed
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@heschi
Copy link
Contributor

heschi commented Apr 8, 2022

When run under x/build/cmd/release, the test fails in all longtest configurations:

--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/build_trimpath_goroot (0.04s)
        script_test.go:260: 
            # Regression test for https://go.dev/issue/51461 and https://go.dev/issue/51483.
            #
            # When built with -trimpath, runtime.GOROOT() returned the bogus string "go"
            # if GOROOT was not set explicitly in the environment.
            # It should instead return the empty string, since we know that we don't
            # have a valid path to return.
            #
            # TODO(#51483): when runtime.GOROOT() returns the empty string,
            # go/build should default to 'go env GOROOT' instead. (0.044s)
            > env GOROOT=
            > env GOROOT_FINAL=
            > [trimpath] ! go env GOROOT
            > [trimpath] stderr '^go: cannot find GOROOT directory: ''go'' binary is trimmed and GOROOT is not set$'
            > [trimpath] stop
            > [short] skip
            > go run .
            [stderr]
            go: cannot find GOROOT directory: /usr/local/go
            [exit status 2]
            FAIL: testdata/script/build_trimpath_goroot.txt:21: unexpected command failure
            
FAIL
FAIL    cmd/go  244.852s

To reproduce, run something like:
release -target linux-amd64-longtest -user $USER -version go1.19beta1 -rev 957cc90c9b350a1d8ef90d992298dfe33cc13980

@heschi heschi added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Apr 8, 2022
@heschi heschi added this to the Go1.19 milestone Apr 8, 2022
@heschi
Copy link
Contributor Author

heschi commented Apr 8, 2022

Worth noting that my redesigned release process in https://go.dev/cl/398694 doesn't exhibit the problem. I'd be interested to know if this indicates an improvement or a bug in the new process.

@bcmills bcmills self-assigned this Apr 8, 2022
@bcmills
Copy link
Member

bcmills commented Apr 8, 2022

I can reproduce this fairly trivially by running:

GOROOT_FINAL=/bogus GOROOT=$(go env GOROOT) ../bin/go test cmd/go -run=TestScript/build_trimpath_goroot

#51504 is peripherally related, although this particular case is definitely a bug in the test (because it reproduces even if I set GOROOT explicitly to the correct value).

@bcmills
Copy link
Member

bcmills commented Apr 8, 2022

I'd be interested to know if this indicates an improvement or a bug in the new process.

I'm going with “probably bug”, because the fact that the test doesn't fail seems to imply that GOROOT_FINAL isn't set to its final value while the tests are being built and run.

@heschi
Copy link
Contributor Author

heschi commented Apr 8, 2022

Ah, yeah, that's correct -- I thought we wouldn't need to set GOROOT_FINAL while running the tests, but that was at least somewhat while I was hoping to use run.bash. OK, will fix.

@gopherbot
Copy link

Change https://go.dev/cl/399156 mentions this issue: cmd/go: fix TestScript/build_trimpath_goroot when built with a mismatched GOROOT_FINAL

@rsc rsc unassigned bcmills Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants