summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/iotests.py
diff options
context:
space:
mode:
authorPeter Maydell2015-07-02 11:44:34 +0200
committerPeter Maydell2015-07-02 11:44:34 +0200
commit6686ce3f1628f045035d58db8890d20705fd5c34 (patch)
treeacbc34609f422f0f2bb0f9cb39ad8d4c8c39bf96 /tests/qemu-iotests/iotests.py
parentMerge remote-tracking branch 'remotes/vivier/tags/pull-m68k-20150629' into st... (diff)
parentblock: remove redundant check before g_slist_find() (diff)
downloadqemu-6686ce3f1628f045035d58db8890d20705fd5c34.tar.gz
qemu-6686ce3f1628f045035d58db8890d20705fd5c34.tar.xz
qemu-6686ce3f1628f045035d58db8890d20705fd5c34.zip
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
# gpg: Signature made Thu Jul 2 10:10:39 2015 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: block: remove redundant check before g_slist_find() block/nfs: limit maximum readahead size to 1MB block/iscsi: restore compatiblity with libiscsi 1.9.0 iotests: Use event_wait in wait_ready qemu-iotests: Add test case for mirror with unmap qemu-iotests: Make block job methods common block: Remove bdrv_reset_dirty block: Fix dirty bitmap in bdrv_co_discard mirror: Do zero write on target if sectors not allocated qmp: Add optional bool "unmap" to drive-mirror block: Add bdrv_get_block_status_above timer: Use a single definition of NSEC_PER_SEC for the whole codebase timer: Move NANOSECONDS_PER_SECONDS to timer.h blockdev: no need to drain+flush in hmp_drive_del qapi: Rename 'dirty-bitmap' mode to 'incremental' qcow2: Handle EAGAIN returned from update_refcount block/iscsi: add support for request timeouts Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r--tests/qemu-iotests/iotests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 04a294d747..8615b10751 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -326,6 +326,29 @@ class QMPTestCase(unittest.TestCase):
self.assert_no_active_block_jobs()
return event
+ def wait_ready(self, drive='drive0'):
+ '''Wait until a block job BLOCK_JOB_READY event'''
+ f = {'data': {'type': 'mirror', 'device': drive } }
+ event = self.vm.event_wait(name='BLOCK_JOB_READY', match=f)
+
+ def wait_ready_and_cancel(self, drive='drive0'):
+ self.wait_ready(drive=drive)
+ event = self.cancel_and_wait(drive=drive)
+ self.assertEquals(event['event'], 'BLOCK_JOB_COMPLETED')
+ self.assert_qmp(event, 'data/type', 'mirror')
+ self.assert_qmp(event, 'data/offset', event['data']['len'])
+
+ def complete_and_wait(self, drive='drive0', wait_ready=True):
+ '''Complete a block job and wait for it to finish'''
+ if wait_ready:
+ self.wait_ready(drive=drive)
+
+ result = self.vm.qmp('block-job-complete', device=drive)
+ self.assert_qmp(result, 'return', {})
+
+ event = self.wait_until_completed(drive=drive)
+ self.assert_qmp(event, 'data/type', 'mirror')
+
def notrun(reason):
'''Skip this test suite'''
# Each test in qemu-iotests has a number ("seq")