Uh oh!
There was an error while loading. Please reload this page.
Implement x.py test src/tools/clippy --bless - #84189
Conversation
rust-highfive
commented
Apr 14, 2021
(rust-highfive has picked a reviewer for you, use r? to override) |
Mark-Simulacrum
commented
Apr 14, 2021
Does this actually work for blessing? Can we hook up x.py to run this? |
jyn514
commented
Apr 14, 2021
I don't know. I don't have time to look into it right now. |
jyn514
commented
Apr 14, 2021
Ok, I updated this to implement |
cargo dev from inside src/tools/clippyx.py test src/tools/clippy --bless@Mark-Simulacrum do you know when you'll have a chance to look at this? In the meantime I've been cherry-picking the commit for #84039. |
There was a problem hiding this comment.
Is there a reason for an explicit message here? compiletest blessing is silent -- is there a reason we can't pull that off here?
FWIW I find it a bit interesting that unlike compiletest this is a separate command etc -- maybe @Manishearth or someone familiar with clippy can say why? I'd expect this to be just a flag passed in to compile test when running clippy's tests.
There was a problem hiding this comment.
No particular reason, I'll remove it.
There was a problem hiding this comment.
separate command
I think it's just because the compiletest bless functionality is newer and we just haven't migrated to it yet. But we also have an added feature where cargo dev bless only updates files that were updated after the last clippy build.
Mark-Simulacrum
commented
Apr 27, 2021
@Manishearth can you either investigate or ping someone who could why we're seeing slightly different test outputs when blessing with this PR (Vec::new -> .., for example; see PR description). |
Manishearth
commented
Apr 27, 2021
unsure what's going on here, that looks like Also it could be divergences in compiletest. We tried to convince the compiler team to move compiletest out of tree but they weren't really in favor. |
flip1995
commented
Apr 27, 2021
jyn514
commented
Apr 27, 2021
It's also possible that I just need to rebase over master or something - I haven't spent too much time looking into this. |
That sounds like it's not unlikely 😄 |
xFrednet
commented
Apr 27, 2021
I'm sadly not totally up to date when it comes to the |
flip1995
commented
Apr 27, 2021
@jyn514 I checked out your branch, rebased it on top of the current master and tried |
flip1995
commented
Apr 27, 2021
It would be great if you could also apply this patch: diff --git a/src/tools/clippy/clippy_dev/src/new_lint.rs b/src/tools/clippy/clippy_dev/src/new_lint.rs
index d951ca0e630..4676c2affad 100644
--- a/src/tools/clippy/clippy_dev/src/new_lint.rs+++ b/src/tools/clippy/clippy_dev/src/new_lint.rs@@ -44,7 +44,7 @@ pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str
create_test(&lint).context("Unable to create a test for the new lint")
}
-fn create_lint(lint: &LintData) -> io::Result<()> {+fn create_lint(lint: &LintData<'_>) -> io::Result<()> {
let (pass_type, pass_lifetimes, pass_import, context_import) = match lint.pass {
"early" => ("EarlyLintPass", "", "use rustc_ast::ast::*;", "EarlyContext"),
"late" => ("LateLintPass", "<'_>", "use rustc_hir::*;", "LateContext"),
@@ -68,7 +68,7 @@ fn create_lint(lint: &LintData) -> io::Result<()> {
write_file(lint.project_root.join(&lint_path), lint_contents.as_bytes())
}
-fn create_test(lint: &LintData) -> io::Result<()> {+fn create_test(lint: &LintData<'_>) -> io::Result<()> {
fn create_project_layout<P: Into<PathBuf>>(lint_name: &str, location: P, case: &str, hint: &str) -> io::Result<()> {
let mut path = location.into().join(case);
fs::create_dir(&path)?; |
- Add clippy_dev to the rust workspace Before, it would give an error that it wasn't either included or excluded from the workspace: ``` error: current package believes it's in a workspace when it's not: current: /home/joshua/rustc/src/tools/clippy/clippy_dev/Cargo.toml workspace: /home/joshua/rustc/Cargo.toml this may be fixable by adding `src/tools/clippy/clippy_dev` to the `workspace.members` array of the manifest located at: /home/joshua/rustc/Cargo.toml Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest. ``` - Change clippy's copy of compiletest not to special-case rust-lang/rust. Using OUT_DIR confused `clippy_dev` and it couldn't find the test outputs. This is one of the reasons why `cargo dev bless` used to silently do nothing (the others were that `CARGO_TARGET_DIR` and `PROFILE` weren't set appropriately). - Run clippy_dev on test failure I tested this by removing a couple lines from a stderr file, and they were correctly replaced. - Fix clippy_dev warnings
jyn514
commented
Apr 27, 2021
Sure thing, done. |
camsteffen
commented
Apr 28, 2021
So no outstanding concerns here? Just checking since I was tagged. |
Mark-Simulacrum
commented
Apr 28, 2021
@jyn514 Can you update the PR description to reflect what I think is the current state, i.e., that this just works? If so, r=me |
jyn514
commented
Apr 28, 2021
Oops, I updated the commit message but not the description. Now fixed. @bors r=Mark-Simulacrum |
bors
commented
Apr 28, 2021
📌 Commit 8c25e27 has been approved by |
Implement `x.py test src/tools/clippy --bless` - Add clippy_dev to the rust workspace Before, it would give an error that it wasn't either included or excluded from the workspace: ``` error: current package believes it's in a workspace when it's not: current: /home/joshua/rustc/src/tools/clippy/clippy_dev/Cargo.toml workspace: /home/joshua/rustc/Cargo.toml this may be fixable by adding `src/tools/clippy/clippy_dev` to the `workspace.members` array of the manifest located at: /home/joshua/rustc/Cargo.toml Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest. ``` - Change clippy's copy of compiletest not to special-case rust-lang/rust. Using OUT_DIR confused `clippy_dev` and it couldn't find the test outputs. This is one of the reasons why `cargo dev bless` used to silently do nothing (the others were that `CARGO_TARGET_DIR` and `PROFILE` weren't set appropriately). - Run clippy_dev on test failure I tested this by removing a couple lines from a stderr file, and they were correctly replaced. - Fix clippy_dev warnings
bors
commented
Apr 29, 2021
⌛ Testing commit 8c25e27 with merge 267ddd8719e80bbcdf8613881b8f87788de74412... |
bors
commented
Apr 29, 2021
💔 Test failed - checks-actions |
rust-log-analyzer
commented
Apr 29, 2021
A job failed! Check out the build log: (web)(plain) Click to see the possible cause of the failure (guessed by this bot) |
jyn514
commented
Apr 29, 2021
@bors retry |
bors
commented
Apr 29, 2021
bors
commented
Apr 29, 2021
☀️ Test successful - checks-actions |
Implement `x.py test src/tools/clippy --bless` - Add clippy_dev to the rust workspace Before, it would give an error that it wasn't either included or excluded from the workspace: ``` error: current package believes it's in a workspace when it's not: current: /home/joshua/rustc/src/tools/clippy/clippy_dev/Cargo.toml workspace: /home/joshua/rustc/Cargo.toml this may be fixable by adding `src/tools/clippy/clippy_dev` to the `workspace.members` array of the manifest located at: /home/joshua/rustc/Cargo.toml Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest. ``` - Change clippy's copy of compiletest not to special-case rust-lang/rust. Using OUT_DIR confused `clippy_dev` and it couldn't find the test outputs. This is one of the reasons why `cargo dev bless` used to silently do nothing (the others were that `CARGO_TARGET_DIR` and `PROFILE` weren't set appropriately). - Run clippy_dev on test failure I tested this by removing a couple lines from a stderr file, and they were correctly replaced. - Fix clippy_dev warnings
estebank
commented
Aug 11, 2021
I'm making some changes to the structured suggestion output, and it seems like I'm unable to get my local environment to fail the tests that are failing in CI. I'm not sure if it is because |
jyn514
commented
Aug 11, 2021
That should work. If it's not, I don't know what's going wrong, sorry. |
I just lost two hours to being in the wrong branch 🤦♂️ Edit: BTW, thank you @jyn514 for improving the workflow here! Had it not been for my PEBKAC problem, the current behavior is almost perfect. |
Add clippy_dev to the rust workspace
Before, it would give an error that it wasn't either included or
excluded from the workspace:
Change clippy's copy of compiletest not to special-case
rust-lang/rust. Using OUT_DIR confused
clippy_devand it couldn't findthe test outputs. This is one of the reasons why
cargo dev blessusedto silently do nothing (the others were that
CARGO_TARGET_DIRandPROFILEweren't set appropriately).Run clippy_dev on test failure
I tested this by removing a couple lines from a stderr file, and they
were correctly replaced.