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

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