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/list_swigcxx with CGO_ENABLED=0 fails if swig is installed. #50205

Closed
dsouzae opened this issue Dec 16, 2021 · 3 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dsouzae
Copy link

dsouzae commented Dec 16, 2021

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

$ go version
1.17.5

Does this issue reproduce with the latest release?

Yes

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

linux / amd64

What did you do?

Build golang from sources using the following command (also note that I do have swig installed):

$ CGO_ENABLED=0 ./all.bash

What did you expect to see?

No failed tests.

What did you see instead?

Failed test:

go test proxy running at GOPROXY=http://127.0.0.1:46794/mod
--- FAIL: TestScript (0.02s)
    --- FAIL: TestScript/list_swigcxx (0.58s)
        script_test.go:253: 
            # go list should not report SWIG-generated C++ files in CompiledGoFiles. (0.000s)
            # CompiledGoFiles should contain 4 files:
            #  a.go
            #  a.swigcxx.go
            #  _cgo_gotypes.go
            #  a.cgo1.go (0.582s)
            # These names we see here, other than a.go, will be from the build cache,
            # so we just count them. (0.000s)
            > stdout a\.go
            > stdout -count=3 $GOCACHE
            FAIL: testdata/script/list_swigcxx.txt:17: no match for `(?m)/usr/local/go/pkg/obj/go-build` found in stdout
            
FAIL
FAIL    cmd/go  52.187s

Also noticed the script list_swigcxx.txt does not have a way to skip the test if CGO_ENABLED is set to 0, only skips if the following are not found: swig and g++.

Workaround: Remove the test script list_swigcxx.txt and the build completed all tests.

@bcmills
Copy link
Contributor

bcmills commented Dec 16, 2021

This was coincidentally fixed already in CL 356610. (If this is causing issues for you, that CL should be trivial to backport!)

@bcmills bcmills added this to the Go1.18 milestone Dec 16, 2021
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 16, 2021
@bcmills bcmills self-assigned this Dec 16, 2021
@bcmills bcmills closed this as completed Dec 16, 2021
@bcmills bcmills changed the title go/build: Build with CGO_ENABLED=0 fails one test if swig is installed. cmd/go: TestScript/list_swigcxx with CGO_ENABLED=0 fails if swig is installed. Dec 16, 2021
@dsouzae
Copy link
Author

dsouzae commented Dec 16, 2021

Thanks, I missed seeing the cgo directive in the script testing code.

@gopherbot
Copy link

Change https://golang.org/cl/372799 mentions this issue: cmd/go: add missing cgo condition in TestScript/mod_list_compiled_concurrent

gopherbot pushed a commit that referenced this issue Dec 16, 2021
…current

Updates #50205

Change-Id: I60d2e32c2cd84599f4a0126e4da4f1d61bd29b51
Reviewed-on: https://go-review.googlesource.com/c/go/+/372799
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@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 NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants