From 75afbb58257bb16c03d3726db432ea079101d9c7 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 31 Jul 2014 16:03:45 -0500 Subject: [CHANGE 23/31] qemu-iotests: Backport 040 To: rhvirt-patches@redhat.com, jen@redhat.com RH-Author: Kevin Wolf Message-id: <1406822631-6570-24-git-send-email-kwolf@redhat.com> Patchwork-id: 60378 O-Subject: [RHEL-6.6 qemu-kvm PATCH v3 23/29] qemu-iotests: Backport 040 Bugzilla: 1122410 RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Jeffrey Cody RH-Acked-by: Max Reitz The tests needs the following adjustments for RHEL 6: * The command is a vendor-specific extension: __com.redhat_block-commit * Commit of the active layer is not supported. test_top_is_active() expects an error now; dropped test_top_is_default_active(). * Some error messages and classes differ from upstream Signed-off-by: Kevin Wolf Signed-off-by: jen --- tests/qemu-iotests/040 | 65 ++++++++++++++++++++-------------------------- tests/qemu-iotests/040.out | 4 +-- 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index f1e16c1..e7399d8 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -60,16 +60,10 @@ class ImageCommitTestCase(iotests.QMPTestCase): 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) + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top=top, base=base) self.assert_qmp(result, 'return', {}) self.wait_for_complete(need_ready) - def run_default_commit_test(self): - self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0') - self.assert_qmp(result, 'return', {}) - self.wait_for_complete() - class TestSingleDrive(ImageCommitTestCase): image_len = 1 * 1024 * 1024 test_len = 1 * 1024 * 256 @@ -95,41 +89,37 @@ class TestSingleDrive(ImageCommitTestCase): self.assertEqual(-1, qemu_io('-c', 'read -P 0xef 524288 524288', backing_img).find("verification failed")) def test_device_not_found(self): - result = self.vm.qmp('block-commit', device='nonexistent', top='%s' % mid_img) + result = self.vm.qmp('__com.redhat_block-commit', device='nonexistent', top='%s' % mid_img) self.assert_qmp(result, 'error/class', 'DeviceNotFound') def test_top_same_base(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='%s' % backing_img, base='%s' % backing_img) - self.assert_qmp(result, 'error/class', 'GenericError') + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % backing_img, base='%s' % backing_img) + self.assert_qmp(result, 'error/class', 'BaseNotFound') self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % backing_img) def test_top_invalid(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='badfile', base='%s' % backing_img) + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='badfile', base='%s' % backing_img) self.assert_qmp(result, 'error/class', 'GenericError') - self.assert_qmp(result, 'error/desc', 'Top image file badfile not found') + self.assert_qmp(result, 'error/desc', "Top 'badfile' not found") def test_base_invalid(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='%s' % mid_img, base='badfile') - self.assert_qmp(result, 'error/class', 'GenericError') + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % mid_img, base='badfile') + self.assert_qmp(result, 'error/class', 'BaseNotFound') self.assert_qmp(result, 'error/desc', 'Base \'badfile\' not found') def test_top_is_active(self): - 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")) - - def test_top_is_default_active(self): - self.run_default_commit_test() - 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")) + self.assert_no_active_block_jobs() + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % test_img, base='%s' % backing_img) + self.assert_qmp(result, 'error/class', 'GenericError') + self.assert_qmp(result, 'error/desc', 'Top image as the active layer is currently unsupported') def test_top_and_base_reversed(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='%s' % backing_img, base='%s' % mid_img) - self.assert_qmp(result, 'error/class', 'GenericError') + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % backing_img, base='%s' % mid_img) + self.assert_qmp(result, 'error/class', 'BaseNotFound') self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % mid_img) @@ -185,36 +175,37 @@ class TestRelativePaths(ImageCommitTestCase): self.assertEqual(-1, qemu_io('-c', 'read -P 0xef 524288 524288', self.backing_img_abs).find("verification failed")) def test_device_not_found(self): - result = self.vm.qmp('block-commit', device='nonexistent', top='%s' % self.mid_img) + result = self.vm.qmp('__com.redhat_block-commit', device='nonexistent', top='%s' % self.mid_img) self.assert_qmp(result, 'error/class', 'DeviceNotFound') def test_top_same_base(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='%s' % self.mid_img, base='%s' % self.mid_img) - self.assert_qmp(result, 'error/class', 'GenericError') + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % self.mid_img, base='%s' % self.mid_img) + self.assert_qmp(result, 'error/class', 'BaseNotFound') self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % self.mid_img) def test_top_invalid(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='badfile', base='%s' % self.backing_img) + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='badfile', base='%s' % self.backing_img) self.assert_qmp(result, 'error/class', 'GenericError') - self.assert_qmp(result, 'error/desc', 'Top image file badfile not found') + self.assert_qmp(result, 'error/desc', "Top 'badfile' not found") def test_base_invalid(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='%s' % self.mid_img, base='badfile') - self.assert_qmp(result, 'error/class', 'GenericError') + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % self.mid_img, base='badfile') + self.assert_qmp(result, 'error/class', 'BaseNotFound') self.assert_qmp(result, 'error/desc', 'Base \'badfile\' not found') def test_top_is_active(self): - self.run_commit_test(self.test_img, self.backing_img) - self.assertEqual(-1, qemu_io('-c', 'read -P 0xab 0 524288', self.backing_img_abs).find("verification failed")) - self.assertEqual(-1, qemu_io('-c', 'read -P 0xef 524288 524288', self.backing_img_abs).find("verification failed")) + self.assert_no_active_block_jobs() + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % self.test_img, base='%s' % self.backing_img) + self.assert_qmp(result, 'error/class', 'GenericError') + self.assert_qmp(result, 'error/desc', 'Top image as the active layer is currently unsupported') def test_top_and_base_reversed(self): self.assert_no_active_block_jobs() - result = self.vm.qmp('block-commit', device='drive0', top='%s' % self.backing_img, base='%s' % self.mid_img) - self.assert_qmp(result, 'error/class', 'GenericError') + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top='%s' % self.backing_img, base='%s' % self.mid_img) + self.assert_qmp(result, 'error/class', 'BaseNotFound') self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % self.mid_img) @@ -240,7 +231,7 @@ class TestSetSpeed(ImageCommitTestCase): self.assert_no_active_block_jobs() self.vm.pause_drive('drive0') - result = self.vm.qmp('block-commit', device='drive0', top=mid_img, speed=1024 * 1024) + result = self.vm.qmp('__com.redhat_block-commit', device='drive0', top=mid_img, speed=1024 * 1024) self.assert_qmp(result, 'return', {}) # Ensure the speed we set was accepted diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out index 42314e9..84bfd63 100644 --- a/tests/qemu-iotests/040.out +++ b/tests/qemu-iotests/040.out @@ -1,5 +1,5 @@ -........................ +...................... ---------------------------------------------------------------------- -Ran 24 tests +Ran 22 tests OK -- 1.9.3