Blame SOURCES/kvm-qemu-iotests-add-option-in-common.qemu-for-mismatch-.patch

4a2fec
From ebcc9ff9c53aca4d9fab9a0839ccbaf54fbf9943 Mon Sep 17 00:00:00 2001
4a2fec
From: Jeffrey Cody <jcody@redhat.com>
4a2fec
Date: Thu, 30 Nov 2017 22:49:09 +0100
4a2fec
Subject: [PATCH 05/21] qemu-iotests: add option in common.qemu for mismatch
4a2fec
 only
4a2fec
4a2fec
RH-Author: Jeffrey Cody <jcody@redhat.com>
4a2fec
Message-id: <050629fe443e53475eed8d77b0d6ed321bd42967.1511985875.git.jcody@redhat.com>
4a2fec
Patchwork-id: 78043
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 05/11] qemu-iotests: add option in common.qemu for mismatch only
4a2fec
Bugzilla: 1506531
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
4a2fec
Add option to echo response to QMP / HMP command only on mismatch.
4a2fec
4a2fec
Useful for ignore all normal responses, but catching things like
4a2fec
segfaults.
4a2fec
4a2fec
Signed-off-by: Jeff Cody <jcody@redhat.com>
4a2fec
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
(cherry picked from commit a2339699c3d35f19253b3b9b51f8a9b8e24f90eb)
4a2fec
Signed-off-by: Jeff Cody <jcody@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 tests/qemu-iotests/common.qemu | 8 +++++++-
4a2fec
 1 file changed, 7 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
4a2fec
index 7645f1d..f646d81 100644
4a2fec
--- a/tests/qemu-iotests/common.qemu
4a2fec
+++ b/tests/qemu-iotests/common.qemu
4a2fec
@@ -49,6 +49,8 @@ _in_fd=4
4a2fec
 #
4a2fec
 # If $silent is set to anything but an empty string, then
4a2fec
 # response is not echoed out.
4a2fec
+# If $mismatch_only is set, only non-matching responses will
4a2fec
+# be echoed.
4a2fec
 function _timed_wait_for()
4a2fec
 {
4a2fec
     local h=${1}
4a2fec
@@ -57,14 +59,18 @@ function _timed_wait_for()
4a2fec
     QEMU_STATUS[$h]=0
4a2fec
     while read -t ${QEMU_COMM_TIMEOUT} resp <&${QEMU_OUT[$h]}
4a2fec
     do
4a2fec
-        if [ -z "${silent}" ]; then
4a2fec
+        if [ -z "${silent}" ] && [ -z "${mismatch_only}" ]; then
4a2fec
             echo "${resp}" | _filter_testdir | _filter_qemu \
4a2fec
                            | _filter_qemu_io | _filter_qmp | _filter_hmp
4a2fec
         fi
4a2fec
         grep -q "${*}" < <(echo ${resp})
4a2fec
         if [ $? -eq 0 ]; then
4a2fec
             return
4a2fec
+        elif [ -z "${silent}" ] && [ -n "${mismatch_only}" ]; then
4a2fec
+            echo "${resp}" | _filter_testdir | _filter_qemu \
4a2fec
+                           | _filter_qemu_io | _filter_qmp | _filter_hmp
4a2fec
         fi
4a2fec
+
4a2fec
     done
4a2fec
     QEMU_STATUS[$h]=-1
4a2fec
     if [ -z "${qemu_error_no_exit}" ]; then
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec