Skip to content

Commit b6d3a60

Browse files
committed
chore: Fix MIRI failure in larger_tasks
Signed-off-by: John Nunley <dev@notgull.net>
1 parent a2c1267 commit b6d3a60

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

tests/larger_tasks.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@ use std::time::Duration;
1010

1111
fn do_run<Fut: Future<Output = ()>>(mut f: impl FnMut(Arc<Executor<'static>>) -> Fut) {
1212
// This should not run for longer than two minutes.
13-
let (_stop_timeout, stopper) = async_channel::bounded::<()>(1);
14-
thread::spawn(move || {
15-
block_on(async move {
16-
let timeout = async {
17-
async_io::Timer::after(Duration::from_secs(2 * 60)).await;
18-
eprintln!("test timed out after 2m");
19-
std::process::exit(1)
20-
};
21-
22-
let _ = stopper.recv().or(timeout).await;
23-
})
24-
});
13+
#[cfg(not(miri))]
14+
let _stop_timeout = {
15+
let (stop_timeout, stopper) = async_channel::bounded::<()>(1);
16+
thread::spawn(move || {
17+
block_on(async move {
18+
let timeout = async {
19+
async_io::Timer::after(Duration::from_secs(2 * 60)).await;
20+
eprintln!("test timed out after 2m");
21+
std::process::exit(1)
22+
};
23+
24+
let _ = stopper.recv().or(timeout).await;
25+
})
26+
});
27+
stop_timeout
28+
};
2529

2630
let ex = Arc::new(Executor::new());
2731

0 commit comments

Comments
 (0)