-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: bad output formatting when test stdout ends in an incomplete line #38063
Comments
This has basically nothing to do with
|
This problem appears to have existed for a long time:
|
Can we really do anything about this? I could not imagine a way to determine the last character from flushed outputs... In the Unless we print a |
Maybe. Test binaries write messages to the |
A dedicated “test metadata” communication channel with JSON or other machine readable format to transport this data around would seem sensible. Then it can be converted to the regular output (or kept as JSON or converted to whatever other output formats that are required) would seem logical to me. Could it even be kept in-process, to avoid the serialisation overhead? |
Unfortunately not. Each package's test is built into a separate binary and run in a separate process. Global side effects from tests and |
Interesting. The Perhaps we could just duplicate meta outputs from testing to a tmp file similar to what @jayconrod suggested, then parse these temp files in test2json? |
I'm not worried about hooking the builtins or anything that hard-codes writes to those file descriptors other than via the |
Change https://golang.org/cl/251597 mentions this issue: |
What's the resolution to this issue? It's currently marked closed, but I couldn't find a clear explanation of why it was closed. Should downstream test frameworks be handling this in some way? Or was it fixed in some version of Go? |
This is a workaround for golang/go#38063, where Go incorrectly reports test results if the test output doesn't end in newlines
@nicks The issue remains unsolved, but not really sure if someone has the interest to write a fix that well balances the implementation complexity and the actual achievements on solving the problem (and probably the reason that @pete-woods of this issue closes this). As for now, a simple workaround is as you referenced: add a |
This is a workaround for golang/go#38063, where Go incorrectly reports test results if the test output doesn't end in newlines
I actually thought the issue was solved (for the most part) with changes to the way the logs are emitted. For me, at least, we moved away from parallel tests at CircleCI after finding extremely marginal to negative benefit to using them. |
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 env
OutputWhat did you do?
then run:
What is the issue?
The JSON output seems corrupted for the "bad" test. You can see that it is missing a "pass" action.
The issue appears to be in the conversion the
test2json
command is doing from stdout of the test runner into JSON. https://github.com/golang/go/blob/master/src/cmd/internal/test2json/test2json.goThe text was updated successfully, but these errors were encountered: