Terminate tests when stuck for 10s (#4905)

This commit is contained in:
Laurenz 2024-09-05 21:59:00 +02:00 committed by GitHub
parent 8a8c4cec77
commit a452fc94bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -100,9 +100,10 @@ impl<'a> Logger<'a> {
self.failed == 0
}
/// Refresh the status.
pub fn refresh(&mut self) {
/// Refresh the status. Returns whether we still seem to be making progress.
pub fn refresh(&mut self) -> bool {
self.print(|_| Ok(())).unwrap();
self.last_change.elapsed() < Duration::from_secs(10)
}
/// Refresh the status print.

View File

@ -94,7 +94,10 @@ fn test() {
// Regularly refresh the logger in case we make no progress.
scope.spawn(move || {
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);
}
}
});