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

x/tools/go/loader: TestCgoOption fails on GOOS=darwin #58493

Open
findleyr opened this issue Feb 13, 2023 · 1 comment
Open

x/tools/go/loader: TestCgoOption fails on GOOS=darwin #58493

findleyr opened this issue Feb 13, 2023 · 1 comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

@pjweinb pointed out that TestCgoOption fails on GOOS=darwin.

I'm on linux, but after hacking up that test, I can reproduce:

go test ./go/loader -run=TestCgoOption
--- FAIL: TestCgoOption (1.42s)
    stdlib_test.go:178: /home/rfindley/src/go/src/net/cgo_unix.go:62:6: func net.cgoLookupHost(ctx context.Context, name string) (hosts []string, err error, completed bool) (CgoEnabled=false)
    stdlib_test.go:187: CGO_ENABLED=0: func net.cgoLookupHost(ctx context.Context, name string) (hosts []string, err error, completed bool) found in cgo_unix.go, want cgo_stub.go
    stdlib_test.go:178: /home/rfindley/src/go/src/net/cgo_unix.go:62:6: func net.cgoLookupHost(ctx context.Context, name string) (hosts []string, err error, completed bool) (CgoEnabled=true)
    stdlib_test.go:178: /home/rfindley/src/go/src/os/user/cgo_lookup_unix.go:18:6: func os/user.current() (*os/user.User, error) (CgoEnabled=false)
    stdlib_test.go:187: CGO_ENABLED=0: func os/user.current() (*os/user.User, error) found in cgo_lookup_unix.go, want lookup_stubs.go
    stdlib_test.go:178: /home/rfindley/src/go/src/os/user/cgo_lookup_unix.go:18:6: func os/user.current() (*os/user.User, error) (CgoEnabled=true)
FAIL
FAIL    golang.org/x/tools/go/loader    1.446s
FAIL

Based on that failure, it looks like the test depends on the location of certain functions across a build-tagged package, to verify that package loading is correctly honoring GOOS/GOARCH. That is bound to eventually run into this type of failure; we should rewrite the test to load a fixed set of testdata packages.

More generally, I think this test may have been failing for a long time, and we never noticed because we don't have darwin longtest builders.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Feb 13, 2023
@gopherbot gopherbot added this to the Unreleased milestone Feb 13, 2023
@gopherbot
Copy link

Change https://go.dev/cl/467695 mentions this issue: go/loader: temporarily skip TestCgoOption on darwin

gopherbot pushed a commit to golang/tools that referenced this issue Feb 13, 2023
This test is failing on darwin, as files have moved in the standard
library.

For golang/go#58493

Change-Id: I5f690af892a2ecccbcb261353dc1a4b0dbc51271
Reviewed-on: https://go-review.googlesource.com/c/tools/+/467695
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@prattmic prattmic added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants