Skip to content

Commit f71878b

Browse files
committed
test(runtime): check that runtime does not abort
1 parent 1ff10ed commit f71878b

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

compio-runtime/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ async-fd = ["dep:compio-io"]
5656
notify-always = ["compio-executor/notify-always"]
5757

5858
current_thread_id = []
59-
nightly = ["current_thread_id"]
59+
60+
sanitize = []
61+
nightly = ["current_thread_id", "sanitize"]
6062

6163
[[test]]
6264
name = "custom_loop"

compio-runtime/tests/panic.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,19 @@ fn panic_spawn() {
1414
panic!("another panic");
1515
})
1616
}
17+
18+
#[test]
19+
#[should_panic]
20+
#[cfg_attr(feature = "sanitize", cfg_attr(sanitize = "address", ignore))]
21+
fn simple_drop() {
22+
compio_runtime::Runtime::new().unwrap().block_on(async {
23+
let handle = compio_runtime::spawn(async {
24+
sleep(Duration::from_millis(100)).await;
25+
});
26+
// Register the waker for handle here to make sure that when the task gets
27+
// dropped, `has_waker` check returns true
28+
compio_runtime::spawn(handle).detach();
29+
sleep(Duration::from_millis(100)).await;
30+
panic!("Main future panics");
31+
})
32+
}

0 commit comments

Comments
 (0)