Skip to content

Commit

Permalink
chore: Fix MIRI failure in larger_tasks
Browse files Browse the repository at this point in the history
Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull committed Mar 25, 2024
1 parent a2c1267 commit b6d3a60
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions tests/larger_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ use std::time::Duration;

fn do_run<Fut: Future<Output = ()>>(mut f: impl FnMut(Arc<Executor<'static>>) -> 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)
};

let _ = stopper.recv().or(timeout).await;
})
});
#[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;
})
});
stop_timeout
};

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

Expand Down

0 comments on commit b6d3a60

Please sign in to comment.