-
Notifications
You must be signed in to change notification settings - Fork 12.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
Filter away test annotations from UI test output #59044
Conversation
cc @rust-lang/compiler |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #59050) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm happy to r+ this PR, assuming nobody has any issues with it, but I suspect it'll be pretty difficult to land w/out a tree-close given how large it is. |
I say we do it.
It should be doable by a quick rebase + bless run while a PR is being processed which doesn't touch stderr files. But a treeclose will make things easier if @petrochenkov has a few contiguous hours to get this working (like if there are random bors failures). |
Ok, I'll rebase it this evening and try to r+ with high priority. |
@bors r=davidtwco p=100 |
📌 Commit 07f99b9 has been approved by |
Filter away test annotations from UI test output If you worked with UI tests for some time you could notice one issue affecting their readability and also readability of diffs when the tests change. Look at the output of this test. ```rust fn main() { let 1 = 2; //~ ERROR refutable pattern in local binding } ``` ``` error[E0005]: refutable pattern in local binding: `-2147483648i32..=0i32` not covered --> src/main.rs:2:9 | 2 | let 1 = 2; //~ ERROR refutable pattern in local binding | ^ pattern `-2147483648i32..=0i32` not covered error: aborting due to previous error For more information about this error, try `rustc --explain E0005`. ``` You can see that the "refutable pattern in local binding" is duplicated. One instance is the actual error, and the second instance is the expected error annotation. This annotation is useful in the test input, but in the output it clutters the text and makes it harder to see what text refers to actual errors and what is just comments, especially if there are many errors in a single test file. @estebank [reported](#57379 (comment)) using the next trick to avoid the clutter ```rust fn main() { let 1 = 2; //~^ ERROR refutable pattern in local binding } ``` ``` error[E0005]: refutable pattern in local binding: `-2147483648i32..=0i32` not covered --> src/main.rs:2:9 | 2 | let 1 = 2; | ^ pattern `-2147483648i32..=0i32` not covered error: aborting due to previous error For more information about this error, try `rustc --explain E0005`. ``` , i.e. using `//~^` and placing the annotation one line below will remove the annotation from the output. However, this doesn't always works (consider errors with multi-line spans), and shouldn't be necessary in general! `compiletest` could automatically filter away its own annotations from the output instead. This is exactly what this PR does. r? @davidtwco
☀️ Test successful - checks-travis, status-appveyor |
Tested on commit rust-lang/rust@7486b9c. Direct link to PR: <rust-lang/rust#59044> 💔 rls on windows: test-pass → test-fail (cc @nrc @Xanewok, @rust-lang/infra).
If you worked with UI tests for some time you could notice one issue affecting their readability and also readability of diffs when the tests change.
Look at the output of this test.
You can see that the "refutable pattern in local binding" is duplicated.
One instance is the actual error, and the second instance is the expected error annotation.
This annotation is useful in the test input, but in the output it clutters the text and makes it harder to see what text refers to actual errors and what is just comments, especially if there are many errors in a single test file.
@estebank reported using the next trick to avoid the clutter
, i.e. using
//~^
and placing the annotation one line below will remove the annotation from the output.However, this doesn't always works (consider errors with multi-line spans), and shouldn't be necessary in general!
compiletest
could automatically filter away its own annotations from the output instead.This is exactly what this PR does.
r? @davidtwco