mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
qemu-iotests: Improve and make use of QMPTestCase.wait_until_completed()
This eliminates code duplication. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
d1db760d7b
commit
9974ad40bf
3 changed files with 9 additions and 55 deletions
|
@ -257,7 +257,7 @@ class QMPTestCase(unittest.TestCase):
|
|||
self.assert_no_active_block_jobs()
|
||||
return result
|
||||
|
||||
def wait_until_completed(self, drive='drive0'):
|
||||
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:
|
||||
|
@ -265,7 +265,8 @@ class QMPTestCase(unittest.TestCase):
|
|||
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)
|
||||
if check_offset:
|
||||
self.assert_qmp(event, 'data/offset', self.image_len)
|
||||
self.assert_qmp(event, 'data/len', self.image_len)
|
||||
completed = True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue