yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-iotests-Add-more-skip_if_unsupported-statements-to-t.patch

ddf19c
From adda561394bb07c13ef3f2712b36704790530891 Mon Sep 17 00:00:00 2001
ddf19c
From: Kevin Wolf <kwolf@redhat.com>
ddf19c
Date: Wed, 3 Jun 2020 16:03:15 +0100
ddf19c
Subject: [PATCH 16/26] iotests: Add more "skip_if_unsupported" statements to
ddf19c
 the python tests
ddf19c
ddf19c
RH-Author: Kevin Wolf <kwolf@redhat.com>
ddf19c
Message-id: <20200603160325.67506-2-kwolf@redhat.com>
ddf19c
Patchwork-id: 97099
ddf19c
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH v2 01/11] iotests: Add more "skip_if_unsupported" statements to the python tests
ddf19c
Bugzilla: 1778593
ddf19c
RH-Acked-by: Eric Blake <eblake@redhat.com>
ddf19c
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ddf19c
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
ddf19c
ddf19c
From: Thomas Huth <thuth@redhat.com>
ddf19c
ddf19c
The python code already contains a possibility to skip tests if the
ddf19c
corresponding driver is not available in the qemu binary - use it
ddf19c
in more spots to avoid that the tests are failing if the driver has
ddf19c
been disabled.
ddf19c
ddf19c
While we're at it, we can now also remove some of the old checks that
ddf19c
were using iotests.supports_quorum() - and which were apparently not
ddf19c
working as expected since the tests aborted instead of being skipped
ddf19c
when "quorum" was missing in the QEMU binary.
ddf19c
ddf19c
Signed-off-by: Thomas Huth <thuth@redhat.com>
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
(cherry picked from commit 9442bebe6e67a5d038bbf2572b79e7b59d202a23)
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 tests/qemu-iotests/030 |  4 +---
ddf19c
 tests/qemu-iotests/040 |  2 ++
ddf19c
 tests/qemu-iotests/041 | 39 +++------------------------------------
ddf19c
 tests/qemu-iotests/245 |  2 ++
ddf19c
 4 files changed, 8 insertions(+), 39 deletions(-)
ddf19c
ddf19c
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
ddf19c
index f3766f2..bddbb30 100755
ddf19c
--- a/tests/qemu-iotests/030
ddf19c
+++ b/tests/qemu-iotests/030
ddf19c
@@ -530,6 +530,7 @@ class TestQuorum(iotests.QMPTestCase):
ddf19c
     children = []
ddf19c
     backing = []
ddf19c
 
ddf19c
+    @iotests.skip_if_unsupported(['quorum'])
ddf19c
     def setUp(self):
ddf19c
         opts = ['driver=quorum', 'vote-threshold=2']
ddf19c
 
ddf19c
@@ -560,9 +561,6 @@ class TestQuorum(iotests.QMPTestCase):
ddf19c
             os.remove(img)
ddf19c
 
ddf19c
     def test_stream_quorum(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         self.assertNotEqual(qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.children[0]),
ddf19c
                             qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.backing[0]),
ddf19c
                             'image file map matches backing file before streaming')
ddf19c
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
ddf19c
index 762ad1e..74f62c3 100755
ddf19c
--- a/tests/qemu-iotests/040
ddf19c
+++ b/tests/qemu-iotests/040
ddf19c
@@ -106,6 +106,7 @@ class TestSingleDrive(ImageCommitTestCase):
ddf19c
         self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 524288', backing_img).find("verification failed"))
ddf19c
         self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 524288 524288', backing_img).find("verification failed"))
ddf19c
 
ddf19c
+    @iotests.skip_if_unsupported(['throttle'])
ddf19c
     def test_commit_with_filter_and_quit(self):
ddf19c
         result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
ddf19c
         self.assert_qmp(result, 'return', {})
ddf19c
@@ -125,6 +126,7 @@ class TestSingleDrive(ImageCommitTestCase):
ddf19c
         self.has_quit = True
ddf19c
 
ddf19c
     # Same as above, but this time we add the filter after starting the job
ddf19c
+    @iotests.skip_if_unsupported(['throttle'])
ddf19c
     def test_commit_plus_filter_and_quit(self):
ddf19c
         result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
ddf19c
         self.assert_qmp(result, 'return', {})
ddf19c
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
ddf19c
index 8568426..a543b15 100755
ddf19c
--- a/tests/qemu-iotests/041
ddf19c
+++ b/tests/qemu-iotests/041
ddf19c
@@ -871,6 +871,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
     image_len = 1 * 1024 * 1024 # MB
ddf19c
     IMAGES = [ quorum_img1, quorum_img2, quorum_img3 ]
ddf19c
 
ddf19c
+    @iotests.skip_if_unsupported(['quorum'])
ddf19c
     def setUp(self):
ddf19c
         self.vm = iotests.VM()
ddf19c
 
ddf19c
@@ -891,9 +892,8 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
         #assemble the quorum block device from the individual files
ddf19c
         args = { "driver": "quorum", "node-name": "quorum0",
ddf19c
                  "vote-threshold": 2, "children": [ "img0", "img1", "img2" ] }
ddf19c
-        if iotests.supports_quorum():
ddf19c
-            result = self.vm.qmp("blockdev-add", **args)
ddf19c
-            self.assert_qmp(result, 'return', {})
ddf19c
+        result = self.vm.qmp("blockdev-add", **args)
ddf19c
+        self.assert_qmp(result, 'return', {})
ddf19c
 
ddf19c
 
ddf19c
     def tearDown(self):
ddf19c
@@ -906,9 +906,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
                 pass
ddf19c
 
ddf19c
     def test_complete(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         self.assert_no_active_block_jobs()
ddf19c
 
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
@@ -925,9 +922,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
                         'target image does not match source after mirroring')
ddf19c
 
ddf19c
     def test_cancel(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         self.assert_no_active_block_jobs()
ddf19c
 
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
@@ -942,9 +936,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
         self.vm.shutdown()
ddf19c
 
ddf19c
     def test_cancel_after_ready(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         self.assert_no_active_block_jobs()
ddf19c
 
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
@@ -961,9 +952,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
                         'target image does not match source after mirroring')
ddf19c
 
ddf19c
     def test_pause(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         self.assert_no_active_block_jobs()
ddf19c
 
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
@@ -989,9 +977,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
                         'target image does not match source after mirroring')
ddf19c
 
ddf19c
     def test_medium_not_found(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         if iotests.qemu_default_machine != 'pc':
ddf19c
             return
ddf19c
 
ddf19c
@@ -1003,9 +988,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
         self.assert_qmp(result, 'error/class', 'GenericError')
ddf19c
 
ddf19c
     def test_image_not_found(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
                              sync='full', node_name='repair0', replaces='img1',
ddf19c
                              mode='existing', target=quorum_repair_img,
ddf19c
@@ -1013,9 +995,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
         self.assert_qmp(result, 'error/class', 'GenericError')
ddf19c
 
ddf19c
     def test_device_not_found(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0',
ddf19c
                              device='nonexistent', sync='full',
ddf19c
                              node_name='repair0',
ddf19c
@@ -1024,9 +1003,6 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
         self.assert_qmp(result, 'error/class', 'GenericError')
ddf19c
 
ddf19c
     def test_wrong_sync_mode(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         result = self.vm.qmp('drive-mirror', device='quorum0', job_id='job0',
ddf19c
                              node_name='repair0',
ddf19c
                              replaces='img1',
ddf19c
@@ -1034,27 +1010,18 @@ class TestRepairQuorum(iotests.QMPTestCase):
ddf19c
         self.assert_qmp(result, 'error/class', 'GenericError')
ddf19c
 
ddf19c
     def test_no_node_name(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
                              sync='full', replaces='img1',
ddf19c
                              target=quorum_repair_img, format=iotests.imgfmt)
ddf19c
         self.assert_qmp(result, 'error/class', 'GenericError')
ddf19c
 
ddf19c
     def test_nonexistent_replaces(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         result = self.vm.qmp('drive-mirror', job_id='job0', device='quorum0',
ddf19c
                              sync='full', node_name='repair0', replaces='img77',
ddf19c
                              target=quorum_repair_img, format=iotests.imgfmt)
ddf19c
         self.assert_qmp(result, 'error/class', 'GenericError')
ddf19c
 
ddf19c
     def test_after_a_quorum_snapshot(self):
ddf19c
-        if not iotests.supports_quorum():
ddf19c
-            return
ddf19c
-
ddf19c
         result = self.vm.qmp('blockdev-snapshot-sync', node_name='img1',
ddf19c
                              snapshot_file=quorum_snapshot_file,
ddf19c
                              snapshot_node_name="snap1");
ddf19c
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
ddf19c
index 919131d..ed972f9 100644
ddf19c
--- a/tests/qemu-iotests/245
ddf19c
+++ b/tests/qemu-iotests/245
ddf19c
@@ -478,6 +478,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
ddf19c
     # This test verifies that we can't change the children of a block
ddf19c
     # device during a reopen operation in a way that would create
ddf19c
     # cycles in the node graph
ddf19c
+    @iotests.skip_if_unsupported(['blkverify'])
ddf19c
     def test_graph_cycles(self):
ddf19c
         opts = []
ddf19c
 
ddf19c
@@ -534,6 +535,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
ddf19c
         self.assert_qmp(result, 'return', {})
ddf19c
 
ddf19c
     # Misc reopen tests with different block drivers
ddf19c
+    @iotests.skip_if_unsupported(['quorum', 'throttle'])
ddf19c
     def test_misc_drivers(self):
ddf19c
         ####################
ddf19c
         ###### quorum ######
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c