Repository navigation
testing: "=== PAUSE" lines do not change the test name for the next log line #40657
Description
Activity
- addedNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Aug 10, 2020 - changed the title
[-]go test log output associated with wrong test[/-][+]cmd/go: go test log output associated with wrong test[/+]on Aug 10, 2020 @davidvanlaatum, could you provide the corresponding snippet of the JSON output?
CC @ianlancetaylor @jadekler
[11:29:34 david@MacBook-Pro tmp]# docker build -t gotestissue . && while docker run -v $(pwd):/out --rm gotestissue;do true;done Sending build context to Docker daemon 14.85kB Step 1/4 : FROM golang:latest ---> baaca3151cdb Step 2/4 : RUN go version ---> Using cache ---> 01a9e374a96e Step 3/4 : ADD . . ---> d57c5aab134c Step 4/4 : CMD ./run.sh ---> Running in bdc51bfce7b0 Removing intermediate container bdc51bfce7b0 ---> dda9fe26e1ea Successfully built dda9fe26e1ea Successfully tagged gotestissue:latest + go version go version go1.14.7 linux/amd64 + go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" 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" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build412486303=/tmp/go-build -gno-record-gcc-switches" + go test -test.count=1 -json ./... + tee /out/output.json + go run ./bla.go TestABC2/#8937 TestABC1/#9993 {"Time":"2020-08-16T01:59:48.796983636Z","Action":"output","Package":"_/go/test","Test":"TestABC2/#8937","Output":" bla_test.go:23: XYZ TestABC1/#9993\n"} exit status 1on a new macbook so can't get as many failures as before but on multiple runs with a single failure like above I see similar to
{"Time":"2020-08-16T01:59:48.796929968Z","Action":"run","Package":"_/go/test","Test":"TestABC2/#8937"} {"Time":"2020-08-16T01:59:48.796932057Z","Action":"output","Package":"_/go/test","Test":"TestABC2/#8937","Output":"=== RUN TestABC2/#8937\n"} {"Time":"2020-08-16T01:59:48.796934445Z","Action":"cont","Package":"_/go/test","Test":"TestABC1/#9993"} {"Time":"2020-08-16T01:59:48.796936531Z","Action":"output","Package":"_/go/test","Test":"TestABC1/#9993","Output":"=== CONT TestABC1/#9993\n"} {"Time":"2020-08-16T01:59:48.79693893Z","Action":"output","Package":"_/go/test","Test":"TestABC2/#8937","Output":"=== PAUSE TestABC2/#8937\n"} {"Time":"2020-08-16T01:59:48.796979675Z","Action":"pause","Package":"_/go/test","Test":"TestABC2/#8937"} {"Time":"2020-08-16T01:59:48.796983636Z","Action":"output","Package":"_/go/test","Test":"TestABC2/#8937","Output":" bla_test.go:23: XYZ TestABC1/#9993\n"}ie
TestABC1/#9993outputs=== CONT TestABC1/#9993
TestABC2/#8937outputs=== PAUSE TestABC2/#8937
TestABC1/#9993outputsbla_test.go:23: XYZ TestABC1/#9993so looks like
TestABC2/#8937manages to send the pause message in betweenTestABC1/#9993CONT and output and thus screws up the tracking of the current testReacted by Bryan C. MillsThanks, that's helpful. This looks like a mismatch between the assumptions of the
testingpackage andcmd/test2json: thetestingpackage assumes that=== PAUSElines do not indicate the currently-running test (since they indicate that the named test is not actively running), whereascmd/test2jsonassumes that they do indicate the currently-running test.We could fix this by making the
testingpackage log redundant=== CONTlines, or by makingcmd/test2jsonno longer assume that== PAUSEindicates that the output that follows is from the now-paused test, or perhaps both.- changed the title
[-]cmd/go: go test log output associated with wrong test[/-][+]cmd/test2json: "=== PAUSE" lines erroneously change the current test name[/+]on Aug 17, 2020 Here is a reduced test case that demonstrates the unusual
=== PAUSE/ output sequencing, and reproduces thetest2jsonissue:example.com$ go test -json | grep 'outer again' {"Time":"2020-08-17T17:21:22.050534953-04:00","Action":"output","Package":"example.com","Test":"TestWeirdTiming/pauser","Output":" example_test.go:13: logging to outer again\n"}- addedNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
on Aug 17, 2020 - removedNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Aug 17, 2020 Change https://golang.org/cl/248727 mentions this issue:
testing: treat PAUSE lines as changing the active test name@gopherbot, please backport to 1.14 and 1.15: this is likely a regression from the original 1.14 release.
Backport issue(s) opened: #40848 (for 1.14), #40849 (for 1.15).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.
- changed the title
[-]cmd/test2json: "=== PAUSE" lines erroneously change the current test name[/-][+]testing: "=== PAUSE" lines do not change the test name for the next log line[/+]on Aug 17, 2020 Change https://golang.org/cl/249097 mentions this issue:
[release-branch.go1.15] testing: treat PAUSE lines as changing the active test nameChange https://golang.org/cl/249098 mentions this issue:
[release-branch.go1.14] testing: treat PAUSE lines as changing the active test name- added a commit that references this issue
on Oct 22, 2020 - locked and limited conversation to collaborators
on Aug 18, 2021 - added a commit that references this issue
on Feb 17, 2026
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
when running tests with go1.14.6 and go1.14.7 still seeing log output of tests going to the wrong test #39308
tmp.zip
attached program runs a bunch of tests and checks for any output that went to the wrong test. It is a little random sometimes does work. Not positive but it seems to only ever be a TestABC1 & TestABC2 (or vice versa) yet to see one where it ends up on a different subtest for the some one
What did you expect to see?
no output
What did you see instead?
docker build -t gotestissue . && docker run --rm gotestissue Sending build context to Docker daemon 13.82kB Step 1/4 : FROM golang:latest ---> baaca3151cdb Step 2/4 : RUN go version ---> Using cache ---> 01a9e374a96e Step 3/4 : ADD . . ---> Using cache ---> af4f025e4da4 Step 4/4 : CMD ./run.sh ---> Using cache ---> e9586b093b23 Successfully built e9586b093b23 Successfully tagged gotestissue:latest + go version go version go1.14.7 linux/amd64 + go env ----------snip---------- + go run ./bla.go + go test -test.count=1 -json ./... TestABC1/#9599 TestABC2/#9750 {"Time":"2020-08-09T07:22:03.834305536Z","Action":"output","Package":"_/go/test","Test":"TestABC1/#9599","Output":" bla_test.go:43: XYZ TestABC2/#9750\n"} TestABC1/#9634 TestABC2/#9728 {"Time":"2020-08-09T07:22:03.836248518Z","Action":"output","Package":"_/go/test","Test":"TestABC1/#9634","Output":" bla_test.go:43: XYZ TestABC2/#9728\n"} TestABC1/#9635 TestABC2/#9723 {"Time":"2020-08-09T07:22:03.836452744Z","Action":"output","Package":"_/go/test","Test":"TestABC1/#9635","Output":" bla_test.go:43: XYZ TestABC2/#9723\n"} TestABC1/#9714 TestABC2/#9699 {"Time":"2020-08-09T07:22:03.840461239Z","Action":"output","Package":"_/go/test","Test":"TestABC1/#9714","Output":" bla_test.go:43: XYZ TestABC2/#9699\n"}