Fix trailing newline in JUnit formatter by ilammy · Pull Request #149437 · rust-lang/rust (original) (raw)
write_message() expects messages to contain no newlines.
Fixes #149436
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
labels
rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
emm, seems there is no unit tests for all the formatters (not the issue for this PR).
There are some tests in tests/run-make/libtest-junit, can you update that to make sure this stays fixed?
Expect the entire input to be a single XML document, instead of reading it line by line. This detects trailing junk better.
Copied validate_junit.py from libtest-junit.
JUnit format works well in edition 2021, but is currently broken in edition 2024 by the mergeable doctest report.
Fix the panic in write_message() which expects messages to contain no embedded newlines. We still want a trailing newline at the end of the file though, so write it in different manner.
Doctest runner no longer panics, but the output is kinda broken
when compile_fail doctests are present. This is because they
are not mergeable.
Added some tests to show how it works in edition 2021, fails in edition 2024, and how it's fixed by this PR.
However, while doing that I found a case that breaks JUnit output in edition 2024. Mergeable doctests will need a bit more work to fix that (should I file a separate issue for this?), but otherwise --format=junit is at least usable in some cases now.
@rustbot ready
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
ilammy changed the title
Remove unnecessary newline in JUnit formatter Fix trailing newline in JUnit formatter
Feel free to cut a separate issue. @bors r+
📌 Commit 069cf9d has been approved by Mark-Simulacrum
It is now in the queue for this repository.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request
Fix trailing newline in JUnit formatter
write_message() expects messages to contain no newlines.
Fixes rust-lang#149436
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request
Fix trailing newline in JUnit formatter
write_message() expects messages to contain no newlines.
Fixes rust-lang#149436
bors added a commit that referenced this pull request
Rollup of 8 pull requests
Successful merges:
- #148755 (Constify
DropGuard::dismissand trait impls) - #148825 (Add SystemTime::{MIN, MAX})
- #149272 (Fix vec iter zst alignment)
- #149417 (tidy: Detect outdated workspaces in workspace list)
- #149437 (Fix trailing newline in JUnit formatter)
- #149773 (fix va_list test by adding a llvmir signext check)
- #149894 (Update to mdbook 0.5)
- #149955 (Fix typo in armv7a-vex-v5 documentation)
r? @ghost
@rustbot modify labels: rollup
bors added S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Whoops. I should have caught onto that when my ./x test passed only with --stage 2. For some reason I thought the big pipeline handles it implicitly. Turns out, rustdoc is a bit special in that stage 1 builds (for some reason I don't fully understand) use stage 0's libtest, so any fix there are not propagated yet. Stage 2 is good though.
I'll go add ignore-stage1 on the new test. I dunno how many existing ones technically need it as well.
stage1's rustdoc is using stage0's libtest which does not have a fix from 069cf9d, making the test run fail. Ensure that this test is executed with everything recompiled in stage2.
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels