[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 1/4] qemu-iotests: reduce chance of races in 185
From: |
Jeff Cody |
Subject: |
[Qemu-block] [PULL 1/4] qemu-iotests: reduce chance of races in 185 |
Date: |
Wed, 16 May 2018 13:42:31 -0400 |
From: Stefan Hajnoczi <address@hidden>
Commit 8565c3ab537e78f3e69977ec2c609dc9417a806e ("qemu-iotests: fix
185") identified a race condition in a sub-test.
Similar issues also affect the other sub-tests. If disk I/O completes
quickly, it races with the QMP 'quit' command. This causes spurious
test failures because QMP events are emitted in an unpredictable order.
This test relies on QEMU internals and there is no QMP API for getting
deterministic behavior needed to make this test 100% reliable. At the
same time, the test is useful and it would be a shame to remove it.
Add sleep 0.5 to reduce the chance of races. This is not a real fix but
appears to reduce spurious failures in practice.
Cc: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
---
tests/qemu-iotests/185 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
index 298d88d04e..975404c99d 100755
--- a/tests/qemu-iotests/185
+++ b/tests/qemu-iotests/185
@@ -118,6 +118,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \
"return"
+# If we don't sleep here 'quit' command races with disk I/O
+sleep 0.5
+
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu
@@ -137,6 +140,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \
"return"
+# If we don't sleep here 'quit' command races with disk I/O
+sleep 0.5
+
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu
@@ -183,6 +189,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \
"return"
+# If we don't sleep here 'quit' command races with disk I/O
+sleep 0.5
+
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu
@@ -201,6 +210,9 @@ _send_qemu_cmd $h \
'speed': 65536 } }" \
"return"
+# If we don't sleep here 'quit' command races with disk I/O
+sleep 0.5
+
_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
wait=1 _cleanup_qemu
--
2.13.6
- [Qemu-block] [PULL 0/4] Block patches, Jeff Cody, 2018/05/08
- [Qemu-block] [PULL 2/4] block/mirror: Make cancel always cancel pre-READY, Jeff Cody, 2018/05/08
- [Qemu-block] [PULL 1/4] block/mirror: honor ratelimit again, Jeff Cody, 2018/05/08
- [Qemu-block] [PULL 3/4] iotests: Add test for cancelling a mirror job, Jeff Cody, 2018/05/08
- [Qemu-block] [PULL 4/4] sheepdog: Fix sd_co_create_opts() memory leaks, Jeff Cody, 2018/05/08
- Re: [Qemu-block] [PULL 0/4] Block patches, Peter Maydell, 2018/05/08