

Stabilize allow_fail test flag · Issue #46488 · rust-lang/rust · GitHub
source link: https://github.com/rust-lang/rust/issues/46488
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

So I just had the following problem with #[allow_fail]
.
I have a test that should raise a cpu exception (e.g. segfault) and fail, so from the docs it looked like #[allow_fail]
was exactly what I needed.
This does not work: the test segfaulting brings the whole test harness down (I assume that a test aborting the process with an error code also brings the whole test harness down).
In hindsight, after having read the source code, it is clear what is going on, but users should not have to read the source code to know what is meant by "fail" (it is a pretty general term).
As I see it the best solution would be to rename #[allow_fail]
to #[allow_assert_fail]
or similar and to document in the docs exactly which kind of "failures" are supported.
An alternative that I would prefer more (since it would cover my use case) but involves significant work that will delay stabilization would be to allow more kinds of failures by spawning the #[allow_fail]
tests on a different process and documenting exactly which kind of failures are allowed.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK