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

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