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

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