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/compile/internal/types2: TestSelf fails if a built pkg/.../syntax.a doesn't exist #56573

Closed
dmitshur opened this issue Nov 4, 2022 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. 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 Nov 4, 2022

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

$ go version
go version go1.19.3 darwin/arm64

Does this issue reproduce with the latest release?

Unsure, there isn't a pre-release version of 1.20 yet.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/dmitri/Library/Caches/go-build"
GOENV="/Users/dmitri/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dmitri/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dmitri/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/dmitri/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/dmitri/gotip/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dmitri/gotip/src/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_0/h0671fcn4rgb5pn9c745dx2h0000gn/T/go-build2358895251=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Install Go on a Mac using the .pkg installer,
then run go test -short cmd/compile/internal/types2.

What did you expect to see?

Passing tests.

What did you see instead?

$ go test -short cmd/compile/internal/types2          
--- FAIL: TestSelf (0.01s)
    self_test.go:27: api.go:28:2: could not import cmd/compile/internal/syntax (can't find import: "cmd/compile/internal/syntax")
FAIL
FAIL	cmd/compile/internal/types2	0.427s
FAIL

Note this doesn't happen during all.bash.


I think the problem is that the test assumes that the pkg/darwin_arm64/cmd/compile/internal/syntax.a file exists. However, we drop pkg/goos_goarch/cmd/... files in the distribution to reduce size (see dropPatterns), and these files will stop existing as part of #47257 (CC @matloob).

Can reproduce this after all.bash with go1.19.3 like this:

$ ./all.bash
[...]
ALL TESTS PASSED
---
Installed Go for darwin/arm64 in /Users/dmitri/gotip
Installed commands in /Users/dmitri/gotip/bin
*** You need to add /Users/dmitri/gotip/bin to your PATH.

$ export PATH="$HOME/gotip/bin:$PATH"

$ go test -short cmd/compile/internal/types2
ok  	cmd/compile/internal/types2	0.465s

$ ls ../pkg/darwin_arm64/cmd/compile/internal/syntax.a 
../pkg/darwin_arm64/cmd/compile/internal/syntax.a

$ rm ../pkg/darwin_arm64/cmd/compile/internal/syntax.a

$ go test -short cmd/compile/internal/types2          
--- FAIL: TestSelf (0.01s)
    self_test.go:27: api.go:28:2: could not import cmd/compile/internal/syntax (can't find import: "cmd/compile/internal/syntax")
FAIL
FAIL	cmd/compile/internal/types2	0.427s
FAIL
@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 Nov 4, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 4, 2022
@dmitshur
Copy link
Contributor Author

dmitshur commented Nov 4, 2022

This might be fixed at tip. The test passes without pkg/darwin_arm64/cmd/compile/internal/syntax.a.

@dmitshur dmitshur added this to the Go1.20 milestone Nov 4, 2022
@dmitshur
Copy link
Contributor Author

dmitshur commented Nov 4, 2022

Yeah, I think this is fixed via CL 432535. Closing and can reopen if we learn otherwise.

@dmitshur dmitshur closed this as completed Nov 4, 2022
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 4, 2022
@golang golang locked and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. 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