cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
26ba25
From 882087e49dc3c3286db14e7c98f3dc557a7af235 Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Tue, 26 Jun 2018 09:47:45 +0200
26ba25
Subject: [PATCH 077/268] qemu-iotests: reduce chance of races in 185
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20180626094856.6924-3-kwolf@redhat.com>
26ba25
Patchwork-id: 81061
26ba25
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 02/73] qemu-iotests: reduce chance of races in 185
26ba25
Bugzilla: 1513543
26ba25
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Fam Zheng <famz@redhat.com>
26ba25
26ba25
From: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
26ba25
Commit 8565c3ab537e78f3e69977ec2c609dc9417a806e ("qemu-iotests: fix
26ba25
185") identified a race condition in a sub-test.
26ba25
26ba25
Similar issues also affect the other sub-tests.  If disk I/O completes
26ba25
quickly, it races with the QMP 'quit' command.  This causes spurious
26ba25
test failures because QMP events are emitted in an unpredictable order.
26ba25
26ba25
This test relies on QEMU internals and there is no QMP API for getting
26ba25
deterministic behavior needed to make this test 100% reliable.  At the
26ba25
same time, the test is useful and it would be a shame to remove it.
26ba25
26ba25
Add sleep 0.5 to reduce the chance of races.  This is not a real fix but
26ba25
appears to reduce spurious failures in practice.
26ba25
26ba25
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
26ba25
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Message-id: 20180508135436.30140-2-stefanha@redhat.com
26ba25
Reviewed-by: Jeff Cody <jcody@redhat.com>
26ba25
Signed-off-by: Jeff Cody <jcody@redhat.com>
26ba25
(cherry picked from commit ddf2d98a94c8a98a661a217fb629cfd15f4dcec7)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
---
26ba25
 tests/qemu-iotests/185 | 12 ++++++++++++
26ba25
 1 file changed, 12 insertions(+)
26ba25
26ba25
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
26ba25
index 298d88d..975404c 100755
26ba25
--- a/tests/qemu-iotests/185
26ba25
+++ b/tests/qemu-iotests/185
26ba25
@@ -118,6 +118,9 @@ _send_qemu_cmd $h \
26ba25
                       'speed': 65536 } }" \
26ba25
     "return"
26ba25
 
26ba25
+# If we don't sleep here 'quit' command races with disk I/O
26ba25
+sleep 0.5
26ba25
+
26ba25
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
26ba25
 wait=1 _cleanup_qemu
26ba25
 
26ba25
@@ -137,6 +140,9 @@ _send_qemu_cmd $h \
26ba25
                       'speed': 65536 } }" \
26ba25
     "return"
26ba25
 
26ba25
+# If we don't sleep here 'quit' command races with disk I/O
26ba25
+sleep 0.5
26ba25
+
26ba25
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
26ba25
 wait=1 _cleanup_qemu
26ba25
 
26ba25
@@ -183,6 +189,9 @@ _send_qemu_cmd $h \
26ba25
                       'speed': 65536 } }" \
26ba25
     "return"
26ba25
 
26ba25
+# If we don't sleep here 'quit' command races with disk I/O
26ba25
+sleep 0.5
26ba25
+
26ba25
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
26ba25
 wait=1 _cleanup_qemu
26ba25
 
26ba25
@@ -201,6 +210,9 @@ _send_qemu_cmd $h \
26ba25
                       'speed': 65536 } }" \
26ba25
     "return"
26ba25
 
26ba25
+# If we don't sleep here 'quit' command races with disk I/O
26ba25
+sleep 0.5
26ba25
+
26ba25
 _send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
26ba25
 wait=1 _cleanup_qemu
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25