diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-09-05 21:59:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 19:59:00 +0000 |
| commit | a452fc94bb8dc5d2f4bdb3fe98506f60308487b6 (patch) | |
| tree | 9c0b9343645e8c3e4819c49cecab720bcc9429f0 /tests/src | |
| parent | 8a8c4cec77342cc8c0772122cd2d0a71085c2c24 (diff) | |
Terminate tests when stuck for 10s (#4905)
Diffstat (limited to 'tests/src')
| -rw-r--r-- | tests/src/logger.rs | 5 | ||||
| -rw-r--r-- | tests/src/tests.rs | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/src/logger.rs b/tests/src/logger.rs index a8ba43c6..45c9f098 100644 --- a/tests/src/logger.rs +++ b/tests/src/logger.rs @@ -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. diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 77c8b210..8558abb6 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -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); + } } }); |
