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
Milestone

Comments

@Helflym
Copy link
Contributor

@Helflym 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

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Feb 27, 2019

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Feb 27, 2019

@bcmills bcmills added this to the Go1.13 milestone Feb 27, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Feb 27, 2019

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

@gopherbot gopherbot closed this in fa8a3f3 Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.