tests/qemu-iotests/testrunner: Print diff to stderr in TAP mode

When running in TAP mode, stdout is reserved for the TAP protocol.
To see the "diff" of the failed test, we have to print it to
stderr instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220209101530.3442837-8-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Thomas Huth 2022-02-09 11:15:29 +01:00 committed by Paolo Bonzini
parent a5c90c61a1
commit 308c8475bc

View File

@ -404,7 +404,10 @@ class TestRunner(ContextManager['TestRunner']):
if res.status == 'fail': if res.status == 'fail':
failed.append(name) failed.append(name)
if res.diff: if res.diff:
print('\n'.join(res.diff)) if self.tap:
print('\n'.join(res.diff), file=sys.stderr)
else:
print('\n'.join(res.diff))
elif res.status == 'not run': elif res.status == 'not run':
notrun.append(name) notrun.append(name)
elif res.status == 'pass': elif res.status == 'pass':