eclipse-iceoryx / eclipse-iceoryx/iceoryx2
Make multithreaded tests with asserts more robust
- Dominant language
- Rust
- Stars
- 2.5k
- Forks
- 185
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 47
Description
## Brief feature description
From https://github.com/elkodon/elkodon/issues/25#issuecomment-1793128951
========
@elfenpiff I found this https://stackoverflow.com/questions/35988775/how-can-i-cause-a-panic-on-a-thread-to-immediately-end-the-main-thread/36031130#36031130
The following code would terminate the whole test when an assert in a thread fails. It can also be placed in a function which could be called at the start of a test
```rust
let orig_hook = panic::take_hook();
panic::set_hook(Box::new(move |panic_info| {
// invoke the default handler and exit the process
orig_hook(panic_info);
process::exit(1);
}));
```
========
Contributor guide
Research direction
Start by locating the multithreaded tests and their current assertion or panic handling, then review the referenced panic-hook approach using panic::take_hook, panic::set_hook, and process::exit. Done means an assertion failure in a test thread reliably terminates the whole test rather than leaving the test running or hiding the failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100