From: Max Reitz Date: Wed, 9 May 2018 19:43:01 +0000 (+0200) Subject: iotests.py: Add qemu_io_silent X-Git-Tag: v3.0.0-rc0~99^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=745f2bf4a5b973d1a69b21db97f9e4219da60624;p=thirdparty%2Fqemu.git iotests.py: Add qemu_io_silent With qemu-io now returning a useful exit code, some tests may find it sufficient to just query that instead of logging (and filtering) the whole output. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20180509194302.21585-5-mreitz@redhat.com Signed-off-by: Max Reitz --- diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index fdbdd8b3009..0b204dc220a 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -133,6 +133,15 @@ def qemu_io(*args): sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args))) return subp.communicate()[0] +def qemu_io_silent(*args): + '''Run qemu-io and return the exit code, suppressing stdout''' + args = qemu_io_args + list(args) + exitcode = subprocess.call(args, stdout=open('/dev/null', 'w')) + if exitcode < 0: + sys.stderr.write('qemu-io received signal %i: %s\n' % + (-exitcode, ' '.join(args))) + return exitcode + class QemuIoInteractive: def __init__(self, *args):