summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests
diff options
context:
space:
mode:
authorPeter Xu2018-04-08 05:05:42 +0200
committerEric Blake2018-04-10 14:42:48 +0200
commitc3988519c4fc3e458fbac4f7814dd775ef4a68d7 (patch)
tree6a62f4ffe09424d7cd33ab4557229b4bba203fdc /tests/qemu-iotests
parentMerge remote-tracking branch 'remotes/xtensa/tags/20180409-xtensa' into staging (diff)
downloadqemu-c3988519c4fc3e458fbac4f7814dd775ef4a68d7.tar.gz
qemu-c3988519c4fc3e458fbac4f7814dd775ef4a68d7.tar.xz
qemu-c3988519c4fc3e458fbac4f7814dd775ef4a68d7.zip
iotests: fix wait_until_completed()
If there are more than one events, wait_until_completed() might return the 2nd event even if the 1st event is JOB_COMPLETED, since the for loop will continue to run even if completed is set to True. It never happened before, but it can be triggered when OOB is enabled due to the RESUME startup message. Fix that up. Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180408030542.17855-1-peterx@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qemu-iotests')
-rw-r--r--tests/qemu-iotests/iotests.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index b5d7945af8..119c8e270a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -470,18 +470,15 @@ class QMPTestCase(unittest.TestCase):
def wait_until_completed(self, drive='drive0', check_offset=True):
'''Wait for a block job to finish, returning the event'''
- completed = False
- while not completed:
+ while True:
for event in self.vm.get_qmp_events(wait=True):
if event['event'] == 'BLOCK_JOB_COMPLETED':
self.assert_qmp(event, 'data/device', drive)
self.assert_qmp_absent(event, 'data/error')
if check_offset:
self.assert_qmp(event, 'data/offset', event['data']['len'])
- completed = True
-
- self.assert_no_active_block_jobs()
- return event
+ self.assert_no_active_block_jobs()
+ return event
def wait_ready(self, drive='drive0'):
'''Wait until a block job BLOCK_JOB_READY event'''