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

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