Skip to content

Commit b2705ea

Browse files
committed
feat(process/test): add timeout for Process::checkpoint()
1 parent 9631682 commit b2705ea

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎src/process.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::{
1212
io::Cursor,
1313
path::Path,
1414
sync::{Arc, Mutex},
15+
time,
1516
};
1617
use std::{env, thread};
1718

@@ -257,9 +258,14 @@ impl Process {
257258
fs::write(checkpoint_path(test_root, name), name)
258259
.expect("failed to write test checkpoint marker");
259260

260-
loop {
261-
thread::park();
261+
let start_time = time::Instant::now();
262+
let max_wait = time::Duration::from_mins(5);
263+
while start_time.elapsed() < max_wait {
264+
thread::sleep(time::Duration::from_secs(10));
262265
}
266+
panic!(
267+
"test checkpoint '{name}' timed out after {max_wait:?} without being killed by the test driver",
268+
);
263269
}
264270
}
265271

0 commit comments

Comments
 (0)