1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
/// A test that a blocking threaddump does not deadlock a program when requested
/// from within a `framed` task.
mod util;
use async_backtrace::framed;
#[test]
fn reentrant() {
util::model(|| util::run(outer()));
}
#[framed]
async fn outer() {
let dump = async_backtrace::taskdump_tree(true);
pretty_assertions::assert_str_eq!(
util::strip(dump),
"\
╼ reentrant::outer::{{closure}} at tests/reentrant.rs:LINE:COL"
);
inner().await;
}
#[framed]
async fn inner() {
let dump = async_backtrace::taskdump_tree(true);
pretty_assertions::assert_str_eq!(
util::strip(dump),
"\
╼ reentrant::outer::{{closure}} at tests/reentrant.rs:LINE:COL
└╼ reentrant::inner::{{closure}} at tests/reentrant.rs:LINE:COL"
);
}
|