[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/47] qemu-iotests: Test BLOCK_JOB_READY event for 0
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 03/47] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit |
Date: |
Fri, 27 Jun 2014 21:08:22 +0200 |
From: Fam Zheng <address@hidden>
There should be a BLOCK_JOB_READY event with active commit, regardless
of image length. Let's test the 0 length image case, and make sure it
goes through the ready->complete process.
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/040 | 12 +++++++++---
tests/qemu-iotests/040.out | 4 ++--
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index 734b6a6..d166810 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -35,12 +35,13 @@ test_img = os.path.join(iotests.test_dir, 'test.img')
class ImageCommitTestCase(iotests.QMPTestCase):
'''Abstract base class for image commit test cases'''
- def run_commit_test(self, top, base):
+ def run_commit_test(self, top, base, need_ready=False):
self.assert_no_active_block_jobs()
result = self.vm.qmp('block-commit', device='drive0', top=top,
base=base)
self.assert_qmp(result, 'return', {})
completed = False
+ ready = False
while not completed:
for event in self.vm.get_qmp_events(wait=True):
if event['event'] == 'BLOCK_JOB_COMPLETED':
@@ -48,8 +49,11 @@ class ImageCommitTestCase(iotests.QMPTestCase):
self.assert_qmp(event, 'data/device', 'drive0')
self.assert_qmp(event, 'data/offset', self.image_len)
self.assert_qmp(event, 'data/len', self.image_len)
+ if need_ready:
+ self.assertTrue(ready, "Expecting BLOCK_JOB_COMPLETED
event")
completed = True
elif event['event'] == 'BLOCK_JOB_READY':
+ ready = True
self.assert_qmp(event, 'data/type', 'commit')
self.assert_qmp(event, 'data/device', 'drive0')
self.assert_qmp(event, 'data/len', self.image_len)
@@ -63,7 +67,7 @@ class TestSingleDrive(ImageCommitTestCase):
test_len = 1 * 1024 * 256
def setUp(self):
- iotests.create_image(backing_img, TestSingleDrive.image_len)
+ iotests.create_image(backing_img, self.image_len)
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
backing_img, mid_img)
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
mid_img, test_img)
qemu_io('-c', 'write -P 0xab 0 524288', backing_img)
@@ -105,7 +109,7 @@ class TestSingleDrive(ImageCommitTestCase):
self.assert_qmp(result, 'error/desc', 'Base \'badfile\' not found')
def test_top_is_active(self):
- self.run_commit_test(test_img, backing_img)
+ self.run_commit_test(test_img, backing_img, need_ready=True)
self.assertEqual(-1, qemu_io('-c', 'read -P 0xab 0 524288',
backing_img).find("verification failed"))
self.assertEqual(-1, qemu_io('-c', 'read -P 0xef 524288 524288',
backing_img).find("verification failed"))
@@ -238,6 +242,8 @@ class TestSetSpeed(ImageCommitTestCase):
self.cancel_and_wait(resume=True)
+class TestActiveZeroLengthImage(TestSingleDrive):
+ image_len = 0
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'])
diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out
index b6f2576..42314e9 100644
--- a/tests/qemu-iotests/040.out
+++ b/tests/qemu-iotests/040.out
@@ -1,5 +1,5 @@
-................
+........................
----------------------------------------------------------------------
-Ran 16 tests
+Ran 24 tests
OK
--
1.8.3.1
- [Qemu-devel] [PULL 00/47] Block patches for 2.1.0-rc0, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 01/47] blockjob: Add block_job_yield(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 02/47] mirror: Go through ready -> complete process for 0 len image, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 06/47] block/nfs: add knob to set readahead, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 05/47] block/nfs: fix url parameter checking, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 03/47] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit,
Kevin Wolf <=
- [Qemu-devel] [PULL 04/47] qemu-iotests: Test 0-length image for mirror, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 08/47] block: Move bdrv_fill_options() call to bdrv_open(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 07/47] block: Create bdrv_fill_options(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 09/47] block: Move json: parsing to bdrv_fill_options(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 11/47] block: Use common driver selection code for bdrv_open_file(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 12/47] block: Inline bdrv_file_open(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 10/47] block: Always pass driver name through options QDict, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 13/47] block: Remove second bdrv_open() recursion, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 14/47] block: Catch backing files assigned to non-COW drivers, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 18/47] block: add qemu-iotest for resize base during live commit, Kevin Wolf, 2014/06/27