From b6d3a60b44de4843cae6e8421715a4162cc2275e Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 23 Mar 2024 16:26:19 -0700 Subject: [PATCH] chore: Fix MIRI failure in larger_tasks Signed-off-by: John Nunley --- tests/larger_tasks.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/larger_tasks.rs b/tests/larger_tasks.rs index 12642ed..cc57988 100644 --- a/tests/larger_tasks.rs +++ b/tests/larger_tasks.rs @@ -10,18 +10,22 @@ use std::time::Duration; fn do_run>(mut f: impl FnMut(Arc>) -> Fut) { // This should not run for longer than two minutes. - let (_stop_timeout, stopper) = async_channel::bounded::<()>(1); - thread::spawn(move || { - block_on(async move { - let timeout = async { - async_io::Timer::after(Duration::from_secs(2 * 60)).await; - eprintln!("test timed out after 2m"); - std::process::exit(1) - }; + #[cfg(not(miri))] + let _stop_timeout = { + let (stop_timeout, stopper) = async_channel::bounded::<()>(1); + thread::spawn(move || { + block_on(async move { + let timeout = async { + async_io::Timer::after(Duration::from_secs(2 * 60)).await; + eprintln!("test timed out after 2m"); + std::process::exit(1) + }; - let _ = stopper.recv().or(timeout).await; - }) - }); + let _ = stopper.recv().or(timeout).await; + }) + }); + stop_timeout + }; let ex = Arc::new(Executor::new());