Blame SOURCES/kvm-iotests.py-Add-qemu_io_silent.patch

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