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

Test cargo lints #5614

Merged
merged 9 commits into from
May 21, 2020
Merged

Test cargo lints #5614

merged 9 commits into from
May 21, 2020

Conversation

ebroto
Copy link
Member

@ebroto ebroto commented May 18, 2020

changelog: Add infrastructure to test cargo lints

Closes #5603

@phansch phansch added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 19, 2020
@phansch phansch self-requested a review May 19, 2020 13:31
Copy link
Member

@phansch phansch left a comment

Choose a reason for hiding this comment

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

Really happy to see tests for the cargo lints 🎉

Just a minor nit - looks good to me overall!

clippy_dev/src/new_lint.rs Show resolved Hide resolved
@phansch phansch added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels May 20, 2020
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

LGTM overall. Maybe we should add a test (not necessarily in this PR) that ensures, that there are no stderr files in the pass dirs

tests/compile-test.rs Outdated Show resolved Hide resolved
tests/ui/ptr_offset_with_cast.fixed Outdated Show resolved Hide resolved
@ebroto ebroto force-pushed the test_cargo_lints branch from 3c7f8d1 to 1a04686 Compare May 21, 2020 12:48
@ebroto
Copy link
Member Author

ebroto commented May 21, 2020

@flip1995 I think the test you mention is a good idea! But I've been thinking about a limitation of this implementation, that we could need in some cases to have multiple fail/pass manifests, for example if we want to test multiple values for the same attribute.

I plan to work on #5041 soon, I think it could be a good excuse to try to come up with a solution to the limitation I mentioned. Since this will probably have an impact in the filesystem layout, I think I could implement the test in that PR.

What do you think?

@flip1995
Copy link
Member

that we could need in some cases to have multiple fail/pass manifests

Instead of checking [pass, fail], you could instead check for starts_with({pass,fail}), so directories fail-this-test will assume that the cargo lint will fail and pass-this-test will assume that the test passes.

On the other hand, why would they even have to be named pass or fail? Couldn't you just walk every subdir of the cargo tests? A missing stderr file would automatically indicate, that a test is pass.

@ebroto
Copy link
Member Author

ebroto commented May 21, 2020

Couldn't you just walk every subdir of the cargo tests? A missing stderr file would automatically indicate, that a test is pass.

Indeed, that's much simpler, I like it 👍 I will make the changes needed and rework a bit the documentation.

Thanks!

@ebroto
Copy link
Member Author

ebroto commented May 21, 2020

So I've applied the discussed changes. I went for leaving the fail/pass directories by default because I think it's good to enforce having at least one of each cases and IMO it's easier to understand for most of the cases.

I think the test is not viable anymore as the nomenclature is not enforced, let me know if you think otherwise.

@flip1995
Copy link
Member

Having pass/fail as default is good.

I think the test is not viable anymore as the nomenclature is not enforced, let me know if you think otherwise.

Yes, with this, we won't need the test.

@flip1995
Copy link
Member

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented May 21, 2020

📌 Commit f9013ff has been approved by flip1995

@bors
Copy link
Contributor

bors commented May 21, 2020

⌛ Testing commit f9013ff with merge 780572b...

@bors
Copy link
Contributor

bors commented May 21, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 780572b to master...

@bors bors merged commit 780572b into rust-lang:master May 21, 2020
@ebroto ebroto deleted the test_cargo_lints branch May 21, 2020 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to test cargo lints
4 participants