From 8b94aa578a64bfad268c331a06ba0c0976c1383d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 9 Feb 2021 18:28:00 +0100 Subject: [PATCH] mtest: hide infinite timeout from the progress report Avoid printing something like "30/-1s" when tests are run without a timeout or with --timeout-multiplier 0. Signed-off-by: Paolo Bonzini --- mesonbuild/mtest.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 79bb07597..d580c7e72 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -537,14 +537,19 @@ class ConsoleLogger(TestLogger): left = '[{}] {} '.format(count, self.SPINNER[self.spinner_index]) self.spinner_index = (self.spinner_index + 1) % len(self.SPINNER) - right = '{spaces} {dur:{durlen}}/{timeout:{durlen}}s'.format( + right = '{spaces} {dur:{durlen}}'.format( spaces=' ' * TestResult.maxlen(), dur=int(time.time() - self.progress_test.starttime), - durlen=harness.duration_max_len, - timeout=int(self.progress_test.timeout or -1)) + durlen=harness.duration_max_len) + if self.progress_test.timeout: + right += '/{timeout:{durlen}}'.format( + timeout=self.progress_test.timeout, + durlen=harness.duration_max_len) + right += 's' detail = self.progress_test.detail if detail: right += ' ' + detail + line = harness.format(self.progress_test, colorize=True, max_left_width=self.max_left_width, left=left, right=right)