Skip to content

Add --regress example to tutorial. #140

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

Merged
merged 1 commit into from
Dec 8, 2021

Conversation

orium
Copy link
Member

@orium orium commented Dec 7, 2021

The script must exit with 0 if there is not problem and non-zero otherwise. Since grep exits with 0 if a line matches the pattern we need to negate its exit code.

@ehuss
Copy link
Collaborator

ehuss commented Dec 7, 2021

I believe the original is correct. It is showing how to automate the previous example, which was trying to detect when E0642 stopped being produced. That is, emitting E0642 is "good" and not emitting it is "bad".

Perhaps you can add a short comment to the script explaining what it is doing?

@orium
Copy link
Member Author

orium commented Dec 7, 2021

Maybe I can give a more clear example that doesn't require explanation (and also reflect a common case):

! cargo check 2>&1 | grep 'internal compiler error'

What do you think?

@ehuss
Copy link
Collaborator

ehuss commented Dec 7, 2021

I probably wouldn't include that as a specific example as it wouldn't be something we'd expect someone to ever write. Detecting ice's is already built in (via --regress=ice). Scripts are best suited for unusual situations, and I think illustrating a real-world example (examining issue rust-lang/rust#55036) is a good way of demonstrating what a script would actually be used for.

@orium orium force-pushed the minor-fix-tutorial branch from 6307431 to 2f49b27 Compare December 7, 2021 22:19
@orium orium changed the title Fix tutorial example for how to test with a script. Add --regress example to tutorial. Dec 7, 2021
@orium orium force-pushed the minor-fix-tutorial branch from 2f49b27 to 41754bf Compare December 7, 2021 22:20
@orium
Copy link
Member Author

orium commented Dec 7, 2021

I probably wouldn't include that as a specific example as it wouldn't be something we'd expect someone to ever write.

I did 🙂. Didn't know about --regress, so I've added an example to the tutorial.

Copy link
Collaborator

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss merged commit 75e76cd into rust-lang:master Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants