[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/97] iotests.py: do not use infinite waits
From: |
Michael Roth |
Subject: |
[PATCH 19/97] iotests.py: do not use infinite waits |
Date: |
Tue, 1 Oct 2019 18:44:58 -0500 |
From: John Snow <address@hidden>
Cap waits to 60 seconds so that iotests can fail gracefully if something
goes wrong.
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
(cherry picked from commit 8b6f5f8b9f3bec5cbeebefab34bae0102a2581b3)
Signed-off-by: Michael Roth <address@hidden>
---
tests/qemu-iotests/iotests.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 8b209ea0ee..8061f01ade 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -521,7 +521,7 @@ class VM(qtest.QEMUQtestMachine):
output_list += [key + '=' + obj[key]]
return ','.join(output_list)
- def get_qmp_events_filtered(self, wait=True):
+ def get_qmp_events_filtered(self, wait=60.0):
result = []
for ev in self.get_qmp_events(wait=wait):
result.append(filter_qmp_event(ev))
@@ -539,10 +539,10 @@ class VM(qtest.QEMUQtestMachine):
# Returns None on success, and an error string on failure
def run_job(self, job, auto_finalize=True, auto_dismiss=False,
- pre_finalize=None):
+ pre_finalize=None, wait=60.0):
error = None
while True:
- for ev in self.get_qmp_events_filtered(wait=True):
+ for ev in self.get_qmp_events_filtered(wait=wait):
if ev['event'] == 'JOB_STATUS_CHANGE':
status = ev['data']['status']
if status == 'aborting':
@@ -633,7 +633,7 @@ class QMPTestCase(unittest.TestCase):
self.assertEqual(self.vm.flatten_qmp_object(json.loads(json_filename[5:])),
self.vm.flatten_qmp_object(reference))
- def cancel_and_wait(self, drive='drive0', force=False, resume=False):
+ def cancel_and_wait(self, drive='drive0', force=False, resume=False,
wait=60.0):
'''Cancel a block job and wait for it to finish, returning the event'''
result = self.vm.qmp('block-job-cancel', device=drive, force=force)
self.assert_qmp(result, 'return', {})
@@ -644,7 +644,7 @@ class QMPTestCase(unittest.TestCase):
cancelled = False
result = None
while not cancelled:
- for event in self.vm.get_qmp_events(wait=True):
+ for event in self.vm.get_qmp_events(wait=wait):
if event['event'] == 'BLOCK_JOB_COMPLETED' or \
event['event'] == 'BLOCK_JOB_CANCELLED':
self.assert_qmp(event, 'data/device', drive)
@@ -657,10 +657,10 @@ class QMPTestCase(unittest.TestCase):
self.assert_no_active_block_jobs()
return result
- def wait_until_completed(self, drive='drive0', check_offset=True):
+ def wait_until_completed(self, drive='drive0', check_offset=True,
wait=60.0):
'''Wait for a block job to finish, returning the event'''
while True:
- for event in self.vm.get_qmp_events(wait=True):
+ for event in self.vm.get_qmp_events(wait=wait):
if event['event'] == 'BLOCK_JOB_COMPLETED':
self.assert_qmp(event, 'data/device', drive)
self.assert_qmp_absent(event, 'data/error')
--
2.17.1
- [PATCH 95/97] s390: PCI: fix IOMMU region init, (continued)
- [PATCH 95/97] s390: PCI: fix IOMMU region init, Michael Roth, 2019/10/01
- [PATCH 63/97] backup: Copy only dirty areas, Michael Roth, 2019/10/01
- [PATCH 08/97] Makefile: add nit-picky mode to sphinx-build, Michael Roth, 2019/10/01
- [PATCH 97/97] scsi: lsi: exit infinite loop while executing script (CVE-2019-12068), Michael Roth, 2019/10/01
- [PATCH 74/97] xen-bus: Fix backend state transition on device reset, Michael Roth, 2019/10/01
- [PATCH 75/97] pr-manager: Fix invalid g_free() crash bug, Michael Roth, 2019/10/01
- [PATCH 94/97] slirp: ip_reass: Fix use after free, Michael Roth, 2019/10/01
- [PATCH 09/97] docs/interop/bitmaps: rewrite and modernize doc, Michael Roth, 2019/10/01
- [PATCH 23/97] iotests: add iotest 256 for testing blockdev-backup across iothread contexts, Michael Roth, 2019/10/01
- [PATCH 91/97] curl: Handle success in multi_check_completion, Michael Roth, 2019/10/01
- [PATCH 19/97] iotests.py: do not use infinite waits,
Michael Roth <=
- Re: [PATCH 00/97] Patch Round-up for stable 4.0.1, freeze on 2019-10-10, Thomas Huth, 2019/10/02
- Re: [PATCH 00/97] Patch Round-up for stable 4.0.1, freeze on 2019-10-10, Philippe Mathieu-Daudé, 2019/10/03
- Re: [PATCH 00/97] Patch Round-up for stable 4.0.1, freeze on 2019-10-10, Alexandr Iarygin, 2019/10/07
- Re: [PATCH 00/97] Patch Round-up for stable 4.0.1, freeze on 2019-10-10, Philippe Mathieu-Daudé, 2019/10/08
- Re: [PATCH 00/97] Patch Round-up for stable 4.0.1, freeze on 2019-10-10, Anthony PERARD, 2019/10/11