diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-01-07 13:18:11 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-01-28 11:13:33 +0100 |
commit | d316859f4e28c74ab8b618895d2a5e0a865d3cf1 (patch) | |
tree | 405a9a5d7da3ef9996dfa672eb6f078bbb99dbea /tests/qemu-iotests/testrunner.py | |
parent | 18c1cdd21d318adf2d02d90e25e9c04f33db76e8 (diff) |
check-block: replace -makecheck with TAP output
Let "meson test" take care of showing the results of the individual tests,
consistently with other output from "make check V=1".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/testrunner.py')
-rw-r--r-- | tests/qemu-iotests/testrunner.py | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index 15788f919e..0eace147b8 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -152,10 +152,10 @@ class TestRunner(ContextManager['TestRunner']): return results - def __init__(self, env: TestEnv, makecheck: bool = False, + def __init__(self, env: TestEnv, tap: bool = False, color: str = 'auto') -> None: self.env = env - self.makecheck = makecheck + self.tap = tap self.last_elapsed = LastElapsedTime('.last-elapsed-cache', env) assert color in ('auto', 'on', 'off') @@ -185,13 +185,16 @@ class TestRunner(ContextManager['TestRunner']): """ Print short test info before/after test run """ test = os.path.basename(test) - if self.makecheck and status != '...': - if status and status != 'pass': - status = f' [{status}]' - else: - status = '' + if test_field_width is None: + test_field_width = 8 - print(f' TEST iotest-{self.env.imgfmt}: {test}{status}') + if self.tap: + if status == 'pass': + print(f'ok {self.env.imgfmt} {test}') + elif status == 'fail': + print(f'not ok {self.env.imgfmt} {test}') + elif status == 'not run': + print(f'ok {self.env.imgfmt} {test} # SKIP') return if lasttime: @@ -343,7 +346,7 @@ class TestRunner(ContextManager['TestRunner']): last_el = self.last_elapsed.get(test) start = datetime.datetime.now().strftime('%H:%M:%S') - if not self.makecheck: + if not self.tap: self.test_print_one_line(test=test, test_field_width=test_field_width, status = 'started' if mp else '...', @@ -372,7 +375,9 @@ class TestRunner(ContextManager['TestRunner']): notrun = [] casenotrun = [] - if not self.makecheck: + if self.tap: + self.env.print_env('# ') + else: self.env.print_env() test_field_width = max(len(os.path.basename(t)) for t in tests) + 2 @@ -398,8 +403,6 @@ class TestRunner(ContextManager['TestRunner']): if res.status == 'fail': failed.append(name) - if self.makecheck: - self.env.print_env() if res.diff: print('\n'.join(res.diff)) elif res.status == 'not run': @@ -412,16 +415,16 @@ class TestRunner(ContextManager['TestRunner']): if res.interrupted: break - if notrun: - print('Not run:', ' '.join(notrun)) + if not self.tap: + if notrun: + print('Not run:', ' '.join(notrun)) - if casenotrun: - print('Some cases not run in:', ' '.join(casenotrun)) + if casenotrun: + print('Some cases not run in:', ' '.join(casenotrun)) - if failed: - print('Failures:', ' '.join(failed)) - print(f'Failed {len(failed)} of {n_run} iotests') - return False - else: - print(f'Passed all {n_run} iotests') - return True + if failed: + print('Failures:', ' '.join(failed)) + print(f'Failed {len(failed)} of {n_run} iotests') + else: + print(f'Passed all {n_run} iotests') + return not failed |