-
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
test2json: associate streaming log output with the originating test #38189
Conversation
Up until this commit the test2json utility made the assumption that log output should be associated with the test named in the most recent line starting with "--- PASS: Test..." or "--- FAIL: Test...". A consequence of issue #24929 is that test log output is no longer buffered (it is emitted almost immediately), making the aforementioned assumption incorrect in the case of tests run in parallel. This commit introduces a map which stores the names of all tests to facilitate attributing emitted logs with their originating tests so that readers of test2json such as IDEs and editors can align log output containing important details about specific test failures with the corresponding test name. Fixes #38050
This PR (HEAD: bf642a8) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/226757 to see it. Tip: You can toggle comments from me using the |
Message from Gobot Gobot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 1: (5 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
This PR (HEAD: 82da4c8) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/226757 to see it. Tip: You can toggle comments from me using the |
Message from Michael Whatcott: Patch Set 2: (5 comments) I've incorporated the suggestions in the comments for patch set 1 in patch set 2. I appreciate the feedback and guidance. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 2:
I ran out of review bandwith for this week, but plan to do another review pass next week. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Michael Whatcott: Patch Set 2:
Thanks! Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 2: (1 comment) Let's put this on hold until we decide what to do about #38458. Certainly we should add the new integration test either way, but we will likely be able to back out the changes to test2json proper. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
This PR (HEAD: 5f65fa4) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/226757 to see it. Tip: You can toggle comments from me using the |
Message from Michael Whatcott: Patch Set 3: (2 comments) All feedback given to date has been incorporated. Thanks! Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 3: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Michael Whatcott: Patch Set 3: (2 comments) If CL 229085 resolves the underlying issues in play (#38050 and #38458) than this CL can be abandoned. Thoughts? Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
@bcmills - I'm assuming that the work being done on https://go-review.googlesource.com/c/go/+/229085/ has made this CL/PR unnecessary. Is that true? |
Message from Bryan C. Mills: Patch Set 3:
I think there is still some value in having an integration test for test association in We should be able to revert the changes in test2json.go, and I'm kind of ambivalent about the new test in test2json/testdata, but I would really like to have the new test in cmd/go/testdata/script as a backstop against future regressions. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Only retain cmd/go/testdata/script/test_json_issue38050.txt
This PR (HEAD: 836bdc9) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/226757 to see it. Tip: You can toggle comments from me using the |
Message from Michael Whatcott: Patch Set 4:
As requested, patch set 4 reverts the changes in test2json.go as well as the new tests in test2json/testdata. It retains the test script at cmd/go/testdata/script/test_json_issue38050.txt to prevent regressions in the future. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 4: Run-TryBot+1 Code-Review+2 (1 comment) Thanks, this looks great. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Gobot Gobot: Patch Set 4: TryBots beginning. Status page: https://farmer.golang.org/try?commit=3dcabfb1 Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Gobot Gobot: Patch Set 4: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Gobot Gobot: Patch Set 4: TryBot-Result-1 2 of 20 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 4:
You may need to rebase and/or re-check-out src/*.bat to fix the linux-amd64 failure. Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Michael Whatcott: Patch Set 4:
By 'rebase', do you mean that I will need to rebase my master branch (github.com/mdwhatcott/go) with the latest master branch of the main repo (github.com/golang/go)? I've done that locally, but git status reports that I "have 1061 and 5 commits respectively" so I want to be sure before pushing... Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Message from Bryan C. Mills: Patch Set 4:
I don't know about the GitHub PR workflow, but if you're using You ideally want to get to a state where you have strictly more commits than upstream. 😅 ¹ https://pkg.go.dev/golang.org/x/review/git-codereview Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
This has turned into lots of overhead for a workaround solution that has now been reduced to a single regression test. I grant permission to anyone that is in a position to insert the test/script contained herein into the Go project. |
Message from Michael Whatcott: Patch Set 4:
Ugh. This has turned into lots of overhead for a workaround solution that has now been reduced to a single regression test. I grant permission to anyone that is in a position to insert the test/script contained herein into the Go project. I'll close the originating PR (#38189). Please don’t reply on this GitHub thread. Visit golang.org/cl/226757. |
Up until this commit the test2json utility made the assumption that
log output should be associated with the test named in the most recent
line starting with "--- PASS: Test..." or "--- FAIL: Test...".
A consequence of issue #24929 is that test log output is no longer
buffered (it is emitted almost immediately), making the aforementioned
assumption incorrect in the case of tests run in parallel.
This commit introduces a map which stores the names of all tests to
facilitate attributing emitted logs with their originating tests so
that readers of test2json such as IDEs and editors can align log output
containing important details about specific test failures with the
corresponding test name.
Fixes #38050