mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Terminate tests when stuck for 10s (#4905)
This commit is contained in:
parent
8a8c4cec77
commit
a452fc94bb
@ -100,9 +100,10 @@ impl<'a> Logger<'a> {
|
|||||||
self.failed == 0
|
self.failed == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refresh the status.
|
/// Refresh the status. Returns whether we still seem to be making progress.
|
||||||
pub fn refresh(&mut self) {
|
pub fn refresh(&mut self) -> bool {
|
||||||
self.print(|_| Ok(())).unwrap();
|
self.print(|_| Ok(())).unwrap();
|
||||||
|
self.last_change.elapsed() < Duration::from_secs(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refresh the status print.
|
/// Refresh the status print.
|
||||||
|
@ -94,7 +94,10 @@ fn test() {
|
|||||||
// Regularly refresh the logger in case we make no progress.
|
// Regularly refresh the logger in case we make no progress.
|
||||||
scope.spawn(move || {
|
scope.spawn(move || {
|
||||||
while receiver.recv_timeout(Duration::from_millis(500)).is_err() {
|
while receiver.recv_timeout(Duration::from_millis(500)).is_err() {
|
||||||
logger.lock().refresh();
|
if !logger.lock().refresh() {
|
||||||
|
eprintln!("tests seem to be stuck");
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user