-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Port clippy away from compiletest to ui_test #10426
Conversation
r? @xFrednet (rustbot has picked a reviewer for you, use r? to override) |
r? @Alexendoo Since you already took some time looking into compiletest and using a distributed binary from the Rust repo in rust-lang/rust#103266. What do you think about this alternative? |
☔ The latest upstream changes (presumably #10423) made this pull request unmergeable. Please resolve the merge conflicts. |
cc @rust-lang/clippy (Could you split the commit between the one that fixes the tests and the one that updates the runner?) |
Nice! I'll take a look at it For those testing locally you'll want ui_test = { git = "https://github.com/oli-obk/ui_test", branch = "aux_build" } Here's some stuff I ran into:
The second is that there's no progress output, I don't know how Related is that sometimes the tests aren't saying why they have failed, e.g. if I put
What's particularly odd there is that passing
|
you need to edit: committed the lockfile, I forgot because it was in |
ah, yea I can do that. Btw: do y'all want dots or filenames by default? I can make it so CI prints filenames and local running prints dots. |
☔ The latest upstream changes (presumably #10324) made this pull request unmergeable. Please resolve the merge conflicts. |
There's some tests that still have
From |
oh oops
I guess for the |
It won't be in the toolchain but config.program.set_file_name(if cfg!(windows) {
"cargo-clippy.exe"
} else {
"cargo-clippy"
}); would hopefully work |
I'd say actually running |
Ah the remaining failure is a flakiness where |
On Windows some backslashes in paths are left behind:
|
8cba97b
to
7224118
Compare
CI is green, though if someone could check whether it works on windows that would be great. There's some follow-ups I want to do, like changing the entire test suite back to I'll update the usage instructions now, too, as it's not necessary anymore to run |
Windows errors: ui: --- tests\ui\track-diagnostics.stderr
+++ <stderr output>
... 3 lines skipped ...
LL | const S: A = B;
| ^ expected `A`, found `B`
--Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
+-Ztrack-diagnostics: created at compiler/rustc_infer\src\infer\error_reporting\mod.rs:LL:CC --- tests\ui\crashes\ice-7868.stderr
+++ <stderr output>
warning: unsafe block missing a safety comment
- --> $DIR/auxiliary/ice-7868-aux.rs:2:5
+ --> $DIR/auxiliary\ice-7868-aux.rs:2:5
|
LL | unsafe { 0 }; ui-cargo needs regex escaping as well:
ui-internal: actual output differed from expected
--- tests\ui-internal\custom_ice_message.stderr
+++ <stderr output>
-thread '<unnamed>' panicked at 'Would you like some help with that?', clippy_lints/src/utils/internal_lints/produce_ice.rs
+thread '<unnamed>' panicked at 'Would you like some help with that?', clippy_lints/src\utils\internal_lints\produce_ice.rs
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
tests/compile-test.rs
Outdated
panic!("I/O failure during tests: {e:?}"); | ||
ui_test::run_tests_generic( | ||
config, | ||
|path| path.ends_with(".rs"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ui-toml suite isn't picking up any tests as this is Path::ends_with
|path| path.ends_with(".rs"), | |
|path| path.extension() == Some("rs".as_ref()), |
tests/compile-test.rs
Outdated
@@ -106,7 +109,8 @@ fn run_ui_toml() { | |||
.parent() | |||
.unwrap() | |||
.display() | |||
.to_string(), | |||
.to_string() | |||
.replace('\\', "/"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this'd still need to go through regex::escape
, as canonical windows paths contain ?
, e.g. \\?\D:\Code\Rust\clippy\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through all of the changes.
Overall, here's what I see:
- a bunch of changes wrt the precise compiletest flags
- some minor changes to output wrt
$DIR
and such, as well as line numbering changes - some new
.fixed
files
(Would be nice to have separate commits for these but it's less of a problem now that i've reviewed them; but for future commits might be worth doing commits incrementally and merging in master
so the review history is preserved)
This all seems okay.
I also found two bugs, one is the "multiple test
flags" one, and one is where some proc macro errors turn up for a couple tests.
So I think we're quite close to landing this. I'd also be open to landing this as is with an issue filed for fixing those buggy tests.
(edit: lol code changed whilst I was reviewing: the "multiple test flags" one is fixed now)
@@ -1,11 +0,0 @@ | |||
error: recursing into entrypoint `a` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like an unintentional deletion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has worked at all, the other test in the same file doesn't have a .stderr
file either. I'm guessing compiletest-rs didn't care that there was an extraneous file lying around if the test passes without output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, seems fair. ty!
You're all too fast ^^ I just pushed it to get it to my windows machine 😅 |
yes, that's either |
From the documentation it sounds like If so, I was basically looking for |
Yolo is what clippy uses. So it is similar to |
Ok, CI is happy, testing against rustc CI now, so the next sync doesn't have a nasty surprise |
The sync is currently blocked on rust-lang/rust#112708 Should we wait until that is resolved and we can actually try this in a sync, or are y'all fine with me just being on on-call for the next sync to fix it? |
I'm ok with merging this now and you and @flip1995 coordinating the sync. |
Does It probably wouldn't block sync but would block any upstream PR that needs to update clippy tests |
no, there is no more way of blessing after running tests. You can only bless while running tests. The command for this is |
I wouldn't block this on the sync. Let's get this merged. 🚀 |
I feel like we have alignment from three team members, so @bors r+ Thanks for your diligence on this!! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Reasons to do this:
ui_test
repoui-cargo
,ui
,ui-toml
out of the box, no need to find and run the tests ourselvesOne thing that is a big difference to
compiletest
is that if a test emits any error, you need to mark all of them with//~ ERROR:
annotations. Since some clippy tests did have (sometimes wrong) annotations, I fixed those tests, but changed no others to have annotations.TODO:
changelog: none
Note: at present the latest changes needed for clippy are only available as a git dependency, but I expect to publish a new crates.io version soon