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

testing: summary and test output interleaved [1.14 backport] #40880

gopherbot opened this issue Aug 19, 2020 · 4 comments

testing: summary and test output interleaved [1.14 backport] #40880

gopherbot opened this issue Aug 19, 2020 · 4 comments


Copy link

@gopherbot gopherbot commented Aug 19, 2020

@bcmills requested issue #40771 to be considered for backport to the next 1.14 minor release.

@gopherbot, please backport to Go 1.14 and 1.15. This appears to be a regression in the 1.14.6 point release, and there is no apparent workaround for users who require JSON-formatted test output.

Copy link

@gopherbot gopherbot commented Sep 2, 2020

Change mentions this issue: [release-branch.go1.14] testing: flush test summaries to stdout atomically when streaming output

@dmitshur dmitshur modified the milestones: Go1.14.9, Go1.14.10 Sep 9, 2020
Copy link

@bcmills bcmills commented Sep 22, 2020

Discussion on #40771 (comment) confirms that the change in question does seem to fix the reported issue, and we haven't had any reports of it regressing any other behavior on the main branch during the 1.16 cycle. I think we should aim to get this into the next minor release.

Copy link

@cagedmantis cagedmantis commented Sep 24, 2020

This has been approved because it's a serious issue without a workaround.

Copy link

@gopherbot gopherbot commented Oct 5, 2020

Closed by merging 26c6b51 to release-branch.go1.14.

@gopherbot gopherbot closed this Oct 5, 2020
gopherbot pushed a commit that referenced this issue Oct 5, 2020
…cally when streaming output

While debugging #40771, I realized that the chatty printer should only
ever print to a single io.Writer (normally os.Stdout). The other
Writer implementations in the chain write to local buffers, but if we
wrote a test's output to a local buffer, then we did *not* write it to
stdout and we should not store it as the most recently logged test.

Because the chatty printer should only ever print to one place, it
shouldn't receive an io.Writer as an argument — rather, it shouldn't
be used at all for destinations other than the main output stream.

On the other hand, when we flush the output buffer to stdout in the
top-level flushToParent call, it is important that we not allow some
other test's output to intrude between the test summary header and the
remainder of the test's output. cmd/test2json doesn't know how to
parse such an intrusion, and it's confusing to humans too.

No test because I couldn't reproduce the user-reported error without
modifying the testing package. (This behavior seems to be very
sensitive to output size and/or goroutine scheduling.)

Fixes #40880
Updates #40771
Updates #38458

Change-Id: Ic19bf1d535672b096ba1c8583a3b74aab6d6d766
Run-TryBot: Bryan C. Mills <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Jay Conrod <>
Reviewed-by: Ian Lance Taylor <>
(cherry picked from commit 51c0bdc)
TryBot-Result: Go Bot <>
Trust: Bryan C. Mills <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants