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/link: TestDWARF acting strangely with t.Parallel() #30429

Closed
Helflym opened this issue Feb 27, 2019 · 3 comments
Closed

cmd/link: TestDWARF acting strangely with t.Parallel() #30429

Helflym opened this issue Feb 27, 2019 · 3 comments
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

@Helflym
Copy link
Contributor

Helflym commented Feb 27, 2019

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

master after this commit

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/chigotc/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/chigotc/go/gopath"
GOPROXY=""
GORACE=""
GOROOT="/home/chigotc/go/goroot"
GOTMPDIR=""
GOTOOLDIR="/home/chigotc/go/goroot/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

TestDWARF "prog" variable is updated after t.Parallel() in t.Run() function. Therefore, TestDWARF/testprog is actually launching testprogcgo.
If you remove t.Parallel(), it doesn't occur anymore.

$ go test -v -run TestDWARF
=== RUN   TestDWARF
=== RUN   TestDWARF/testprog
=== PAUSE TestDWARF/testprog
=== RUN   TestDWARF/testprogcgo
=== PAUSE TestDWARF/testprogcgo
=== CONT  TestDWARF/testprog
=== CONT  TestDWARF/testprogcgo
--- PASS: TestDWARF (0.19s)
    --- PASS: TestDWARF/testprogcgo (3.35s)
        dwarf_test.go:48: log before parallel  testprogcgo
        dwarf_test.go:50: log after parallel  testprogcgo
    --- PASS: TestDWARF/testprog (3.35s)
        dwarf_test.go:48: log before parallel  testprog
        dwarf_test.go:50: log after parallel  testprogcgo
=== RUN   TestDWARFiOS
--- SKIP: TestDWARFiOS (0.00s)
    dwarf_test.go:150: skipping on non-darwin/amd64 platform
PASS
ok  	cmd/link	3.545s
@bcmills
Copy link
Contributor

bcmills commented Feb 27, 2019

This also leads to some builder flakes:
https://build.golang.org/log/eb0a0138624df5b3cc4c7d1199fe3b1c5ed780c8

@bcmills
Copy link
Contributor

bcmills commented Feb 27, 2019

CC @cherrymui @rsc @mdempsky @ianlancetaylor for cmd/link.

@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. labels Feb 27, 2019
@bcmills bcmills added this to the Go1.13 milestone Feb 27, 2019
@gopherbot
Copy link

Change https://golang.org/cl/164119 mentions this issue: cmd/link: do not close over the loop variable in testDWARF

@golang golang locked and limited conversation to collaborators Feb 27, 2020
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

3 participants