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/metrics: TestDescriptionDocs fails when GOROOT_FINAL is non-empty #43085

Closed
dmitshur opened this issue Dec 9, 2020 · 1 comment
Closed
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 Dec 9, 2020

At tip-ish:

$ go version
go version devel +01b76d5fbc Tue Dec 8 19:45:23 2020 +0000 darwin/amd64

The TestDescriptionDocs test passes when GOROOT_FINAL is empty (vast majority of the time):

$ GOROOT_FINAL= go test -count=1 -v -run=TestDescriptionDocs runtime/metrics         
=== RUN   TestDescriptionDocs
--- PASS: TestDescriptionDocs (0.00s)
PASS
ok  	runtime/metrics	0.206s

But fails when non-empty:

$ GOROOT_FINAL=/usr/local/go go test -count=1 -v -run=TestDescriptionDocs runtime/metrics
=== RUN   TestDescriptionDocs
    description_test.go:39: open /usr/local/go/src/runtime/metrics/doc.go: no such file or directory
--- FAIL: TestDescriptionDocs (0.00s)
FAIL
FAIL	runtime/metrics	0.127s

This is only a problem if it's important for runtime/metrics tests to be able to pass when GOROOT_FINAL is set. @mknyszek Is that an environment configuration you'd like to support?

If so, I suspect fixing the test can be done by simplifying:

// Get doc.go.
_, filename, _, _ := runtime.Caller(0)
filename = filepath.Join(filepath.Dir(filename), "doc.go")

f, err := os.Open(filename)

To just os.Open("doc.go"), because go test always sets the working directory to that of the package, so there's no need to do more.

This currently affects release testing (similarly to #39385, #39478, #39386 in the past), but we can easily work around it on our side by no longer setting GOROOT_FINAL during release testing. (I think that's likely what we'll do independent of this issue, but it's a separate discussion. I think we may also want a builder where GOROOT_FINAL is set to help catch such test failures.)

CC @bcmills, @golang/release.

@dmitshur dmitshur added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 9, 2020
@dmitshur dmitshur added this to the Go1.16 milestone Dec 9, 2020
@gopherbot
Copy link

Change https://golang.org/cl/276452 mentions this issue: runtime/metrics: simplify test to support more environments

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 9, 2020
@dmitshur dmitshur self-assigned this Dec 9, 2020
@golang golang locked and limited conversation to collaborators Dec 9, 2021
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

2 participants