diff options
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r-- | tests/qemu-iotests/iotests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 8a8f181..b028a89 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -208,6 +208,21 @@ class QMPTestCase(unittest.TestCase): self.assert_no_active_block_jobs() return result + def wait_until_completed(self, drive='drive0'): + '''Wait for a block job to finish, returning the event''' + completed = False + while not completed: + 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') + self.assert_qmp(event, 'data/offset', self.image_len) + self.assert_qmp(event, 'data/len', self.image_len) + completed = True + + self.assert_no_active_block_jobs() + return event + def notrun(reason): '''Skip this test suite''' # Each test in qemu-iotests has a number ("seq") |