-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(profile): panic behavior can be specified for custom harness #11272
base: master
Are you sure you want to change the base?
Conversation
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
7c8c55e
to
646975d
Compare
It failed on Windows with an exit code other than 101 ( Should we ignore Windows or assert with this status code? https://github.com/rust-lang/cargo/actions/runs/3303170253/jobs/5450785138#step:10:3026 |
I think it would be ok to use |
646975d
to
ce51a91
Compare
I've been thinking about this for a while. Some thoughts: Backwards compatibilityI'm a little concerned about the scenario where someone has a custom test harness that relies on the ability to unwind panics (the same limitation as libtest). This change would make that not operate quite correctly. It's hard to predict if there are any users with that scenario (I did not see any on crates.io). I think the workaround is for the user to specify I'm having a hard time deciding to make the call on whether or not this change would be acceptable. It may be very likely that nobody is relying on this, but that seems really hard to predict. Also, the workaround may be very simple, which may be sufficient? My only other idea would be to have a warning period, but I'm not sure how to do that in a nice way. We could detect if there is a Unused warningI think it would be fine to change the implementation of the
If that is too much trouble, or too complex, or too much of a false-positive, I would consider just removing the warning altogether. I'm not sure it is all that valuable. Also, hopefully some day panic-abort-tests will be stabilized and all this can go away. |
Re: Backwards compatibilityIt sounds great to have a warning period. However, it's hard to give a "right" suggestion, as we don't know the intent of users even they explicitly set but rely on the Warning when Maybe we should only warn those also setting Re: Unused warningIt doesn't sound too complex to implement, but does introduce some of a false-positive. I lean to removing the existing warning. |
☔ The latest upstream changes (presumably #11445) made this pull request unmergeable. Please resolve the merge conflicts. |
0468dd5
to
3ac3462
Compare
Rebased due to the refactor of |
Hi @ehuss. What is the status of this? Not urgent though 😉. |
☔ The latest upstream changes (presumably #12768) made this pull request unmergeable. Please resolve the merge conflicts. |
It's libtest that requires tests to be always unwound. For custom harnesses they don't need such a requirement. Cargo relaxes it a bit in profile settings.
Are you testing your project with this pull request? Could you provide a minimal reproducible example so that people can look into that? |
☔ The latest upstream changes (presumably #14128) made this pull request unmergeable. Please resolve the merge conflicts. |
What does this PR try to resolve?
It's libtest that requires tests to be always unwound.
For custom harnesses they don't need such a requirement.
Cargo relaxes it a bit in profile settings.
Fixes #11214
How should we test and review this PR?
First, is this change what we want? IMO it is unnecessary to restrict the panic behaviour of a custom harness.
Additional information
This error message1 will become a lie if a user sets panic in
test
/bench
profile with a custom harness. I am not sure what to do. We can pass a flag in to informTomlProfile
there is some custom harness, though I feel it is not worth doing that, asTomlProfile
should only know about information from itself. It might also touch too many of functions if we want to provide such an accurate message.Maybe we can tweak the message a bit, such as
Mind that if you set
panic=abort
in profiledev
/release
, the warning won't show. However, the panic behaviour is still not applied at all for yourcargo test
units.Footnotes
https://github.com/rust-lang/cargo/blob/b1b25a025565fd71dfa2db4a24f440ab4d32fc6c/src/cargo/util/toml/mod.rs#L642 ↩