ae23c9
From 2491da98d7e2b2026075fb1ab87bc1a242f3dd1e Mon Sep 17 00:00:00 2001
ae23c9
From: Max Reitz <mreitz@redhat.com>
ae23c9
Date: Mon, 18 Jun 2018 16:43:11 +0200
ae23c9
Subject: [PATCH 052/268] iotests.py: Add qemu_io_silent
ae23c9
ae23c9
RH-Author: Max Reitz <mreitz@redhat.com>
ae23c9
Message-id: <20180618164312.24423-5-mreitz@redhat.com>
ae23c9
Patchwork-id: 80777
ae23c9
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 4/5] iotests.py: Add qemu_io_silent
ae23c9
Bugzilla: 1519617
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
ae23c9
With qemu-io now returning a useful exit code, some tests may find it
ae23c9
sufficient to just query that instead of logging (and filtering) the
ae23c9
whole output.
ae23c9
ae23c9
Signed-off-by: Max Reitz <mreitz@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
Message-id: 20180509194302.21585-5-mreitz@redhat.com
ae23c9
Signed-off-by: Max Reitz <mreitz@redhat.com>
ae23c9
(cherry picked from commit 745f2bf4a5b973d1a69b21db97f9e4219da60624)
ae23c9
Signed-off-by: Max Reitz <mreitz@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 tests/qemu-iotests/iotests.py | 9 +++++++++
ae23c9
 1 file changed, 9 insertions(+)
ae23c9
ae23c9
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
ae23c9
index 26e6046..2ce85a1 100644
ae23c9
--- a/tests/qemu-iotests/iotests.py
ae23c9
+++ b/tests/qemu-iotests/iotests.py
ae23c9
@@ -120,6 +120,15 @@ def qemu_io(*args):
ae23c9
         sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args)))
ae23c9
     return subp.communicate()[0]
ae23c9
 
ae23c9
+def qemu_io_silent(*args):
ae23c9
+    '''Run qemu-io and return the exit code, suppressing stdout'''
ae23c9
+    args = qemu_io_args + list(args)
ae23c9
+    exitcode = subprocess.call(args, stdout=open('/dev/null', 'w'))
ae23c9
+    if exitcode < 0:
ae23c9
+        sys.stderr.write('qemu-io received signal %i: %s\n' %
ae23c9
+                         (-exitcode, ' '.join(args)))
ae23c9
+    return exitcode
ae23c9
+
ae23c9
 
ae23c9
 class QemuIoInteractive:
ae23c9
     def __init__(self, *args):
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9