Skip to content
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

Check .fixed paths' existence in run_ui #8844

Merged
merged 4 commits into from
May 28, 2022
Merged

Conversation

smoelius
Copy link
Contributor

@smoelius smoelius commented May 19, 2022

This PR adds a test to check that there exists a .fixed file for every .stderr file in tests/ui that mentions a MachineApplicable lint. The test leverages compiletest-rs's rustfix_coverage option.

I tried to add .fixed files where they appeared to be missing. However, 38 exceptional .rs files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.)

changelog: none

@rust-highfive
Copy link

r? @flip1995

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 19, 2022
@xFrednet
Copy link
Member

xFrednet commented May 19, 2022

I believe there are a few lints with different lint emissions and applicability based on the context. 🙃 If we add something like this, I think we should add some option to disable it for specific test files.

cc: @rust-lang/clippy, @Alexendoo, @dswij, @Jarcho

@smoelius
Copy link
Contributor Author

If we add something like this, I think we should add some option to disable it for specific test files.

I'm not sure if this is what you have in mind, but that sounds like what I did here: https://github.com/rust-lang/rust-clippy/pull/8844/files#diff-30869434167a8e693c01b4875d4855efeb3a28567f6531765b202e82cc398a99R59

tests/dogfood.rs Outdated Show resolved Hide resolved
@xFrednet
Copy link
Member

It looks like nobody has any concerns regarding this change, and I also like it.

r? @Alexendoo

@xFrednet xFrednet self-assigned this May 21, 2022
@Alexendoo
Copy link
Member

I like the idea, trying it locally it does take quite a while to run though, took up to a minute for me. compiletest has rustfix_coverage for this that we could enable in run_ui, it creates a text file with the list of relevant files

Unfortunately the version of rustfix in the fork crashes when this is enabled, it's fixed upstream (rust-lang/rustfix#199) but I don't know what the process for updating the compiletest fork would be (sync all the upstream changes or just bump the rustfix version?)

@smoelius
Copy link
Contributor Author

I don't know what the process for updating the compiletest fork would be (sync all the upstream changes or just bump the rustfix version?)

Sorry, but I don't understand what the two alternatives are (possibly because I don't know what "the compiletest fork" refers to).

One alternative is to bump the rustfix version in compiletest, and once compiletest is updated, (possibly) bump the compiletest version in Ciippy (correct?).

What is the other alternative?

@Alexendoo
Copy link
Member

Clippy uses https://github.com/Manishearth/compiletest-rs, which is extracted from https://github.com/rust-lang/rust/tree/master/src/tools/compiletest. The one in rust-lang/rust has the updated rustfix dep of 0.6.0, but I wasn't sure what the usual way to get upstream changes into the compiletest-rs repo is

The sync all thing would be to round up all of the upstream changes in one PR, but looking at other PRs to the repo I don't think that's how it's done. So a PR that bumps the rustfix version alone should be good

@smoelius
Copy link
Contributor Author

Submitted. I'll update this PR once a new version of compiletest-rs is published.

@smoelius
Copy link
Contributor Author

@Alexendoo I'm sorry if you were telling me this and I didn't get it: rust-lang/rustfix#199 is not in rustfix 0.6.0. So, I've requested a new release of rustfix.

@Alexendoo
Copy link
Member

Oh whoops I thought it was, my mistake

@smoelius smoelius changed the title Add fixed_path_existence test Check .fixed paths' existence in run_ui May 24, 2022
@smoelius
Copy link
Contributor Author

I've updated the PR to use rustfix_coverage. You're welcome to review whenever you have time.

Copy link
Member

@Alexendoo Alexendoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks!

You can also now merge these into their respective main test files, or delete them if the contents are duplicates

  • tests/ui/needless_late_init_fixable.rs
  • tests/ui/unnecessary_cast_fixable.rs

tests/compile-test.rs Outdated Show resolved Hide resolved
tests/compile-test.rs Outdated Show resolved Hide resolved
tests/compile-test.rs Show resolved Hide resolved
@smoelius
Copy link
Contributor Author

@Alexendoo I think I have addressed all of your comments.

tests/compile-test.rs Outdated Show resolved Hide resolved
Copy link
Member

@Alexendoo Alexendoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @smoelius!

LGTM @xFrednet

@xFrednet
Copy link
Member

Looks good to me, thank you for this addition :)

Also thank you, @Alexendoo, for the nice suggestion with the updated dependency. I wouldn't have known about that!

@bors r=Alexendoo,xFrednet

@bors
Copy link
Collaborator

bors commented May 27, 2022

📌 Commit 534fc5d has been approved by Alexendoo,xFrednet

@bors
Copy link
Collaborator

bors commented May 27, 2022

⌛ Testing commit 534fc5d with merge 82c52e8...

bors added a commit that referenced this pull request May 27, 2022
Check `.fixed` paths' existence in `run_ui`

This PR adds a test to check that there exists a `.fixed` file for every `.stderr` file in `tests/ui` that mentions a `MachineApplicable` lint. The test leverages `compiletest-rs`'s `rustfix_coverage` option.

I tried to add `.fixed` files where they appeared to be missing. However, 38 exceptional `.rs` files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.)

changelog: none
@bors
Copy link
Collaborator

bors commented May 27, 2022

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors
Copy link
Collaborator

bors commented May 27, 2022

📌 Commit 534fc5d has been approved by xFrednet

@bors
Copy link
Collaborator

bors commented May 27, 2022

⌛ Testing commit 534fc5d with merge 49aa6c5...

bors added a commit that referenced this pull request May 27, 2022
Check `.fixed` paths' existence in `run_ui`

This PR adds a test to check that there exists a `.fixed` file for every `.stderr` file in `tests/ui` that mentions a `MachineApplicable` lint. The test leverages `compiletest-rs`'s `rustfix_coverage` option.

I tried to add `.fixed` files where they appeared to be missing. However, 38 exceptional `.rs` files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.)

changelog: none
@xFrednet
Copy link
Member

@bors r-

@xFrednet
Copy link
Member

@bors r=Alexendoo,xFrednet

@bors
Copy link
Collaborator

bors commented May 27, 2022

📌 Commit 534fc5d has been approved by Alexendoo,xFrednet

bors added a commit that referenced this pull request May 27, 2022
Check `.fixed` paths' existence in `run_ui`

This PR adds a test to check that there exists a `.fixed` file for every `.stderr` file in `tests/ui` that mentions a `MachineApplicable` lint. The test leverages `compiletest-rs`'s `rustfix_coverage` option.

I tried to add `.fixed` files where they appeared to be missing. However, 38 exceptional `.rs` files remain. Several of those include comments indicating that they are exceptions, though not all do. Apologies, as I have not tried to associate the 38 files with GH issues. (I think that would be a lot of work, and I worry about linking the wrong issue.)

changelog: none
@bors
Copy link
Collaborator

bors commented May 27, 2022

⌛ Testing commit 534fc5d with merge 54f237f...

@bors
Copy link
Collaborator

bors commented May 27, 2022

💔 Test failed - checks-action_test

@Alexendoo
Copy link
Member

👀 Oh whoops that's my fault #8896

Maybe it would be worth ignoring the crashes dir though

@smoelius
Copy link
Contributor Author

smoelius commented May 27, 2022

👀 Oh whoops that's my fault #8896

Maybe it would be worth ignoring the crashes dir though

In a way, this is a success! :D

What is your preference? I rebase and fix this, or ignore the the crashes dir (and maybe revert the changes thereto)?

@smoelius
Copy link
Contributor Author

smoelius commented May 27, 2022

I rebased and added a commit for ice-8850. Please let me know if you would rather ignore the crashes dir.

@xFrednet
Copy link
Member

I think it would be good to ignore the crashes directory. The focus of those UI tests is not to test the lint, but the lint implementation itself. Either option would be correct, though. If it's simple to do, I would appreciate that change. 🙃

@smoelius
Copy link
Contributor Author

Oops, I forgot about Windows again.

@xFrednet
Copy link
Member

xFrednet commented May 27, 2022

This version looks good to me, thank you for the work! I'll leave the final r+ to @Alexendoo 🙃

@bors delegate=Alexendoo

@bors
Copy link
Collaborator

bors commented May 27, 2022

✌️ @Alexendoo can now approve this pull request

@Alexendoo
Copy link
Member

Looks all good to me too, thanks @smoelius

@bors r+

@bors
Copy link
Collaborator

bors commented May 28, 2022

📌 Commit 6027255 has been approved by Alexendoo

@bors
Copy link
Collaborator

bors commented May 28, 2022

⌛ Testing commit 6027255 with merge 5920fa3...

@bors
Copy link
Collaborator

bors commented May 28, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 5920fa3 to master...

@bors bors merged commit 5920fa3 into rust-lang:master May 28, 2022
@smoelius smoelius deleted the fixed-paths branch May 28, 2022 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants