Commit ddf2d98a authored by Stefan Hajnoczi's avatar Stefan Hajnoczi Committed by Jeff Cody
Browse files

qemu-iotests: reduce chance of races in 185



Commit 8565c3ab ("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 <vsementsov@virtuozzo.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Message-id: 20180508135436.30140-2-stefanha@redhat.com
Reviewed-by: default avatarJeff Cody <jcody@redhat.com>
Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
parent c416eece
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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