Description
I would like to be able to mark a test as a death test of some kind, like, running this code should trigger an abort
(instead of just an unwind), an exit
with a particular exit code, or an assert
(in case assert
doesn't unwind if, e.g. panic=abort
).
This requires two fundamental ingredients, libtests needs to support:
- spawning test in different processes (that is, process spawning/setup and teardown)
- marking tests as death tests (and maybe indicate the type).
A way to mark a test as a death test is important, since in the case in which panic != abort
one still wants all the non death tests to happen within the same process for speed, but libtest stills need to spawn different processes for the death tests only (so it needs a way to tell these apart).
For crates in which panic == abort
, it would be nice if one could turn all tests into death tests at the crate level.
This issue is tangentially related to: rust-lang/rfcs#1513
Google Test is probably the most famous unit-testing framework that supports these although in C++ other frameworks do as well. It usually takes 3k LOC C++ code to implement a "portable" process spawning/set up/tear down mechanism for spawning death tests, so it is quite a bit of machinery that might better belong outside of rustc.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status