null-aio may not be whitelisted. If it is not, fall back to null-co. This may run tests twice in the same configuration, but this is the simplest way to effectively skip the tests in setUp() (without changing the output, and while having the respective driver in a class attribute).
Signed-off-by: Max Reitz <mre...@redhat.com> --- tests/qemu-iotests/093 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index bd56c94708..d6f285001a 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -22,9 +22,11 @@ import iotests nsec_per_sec = 1000000000 +supported_null_drivers = list(filter(lambda f: f.startswith('null-'), + iotests.supported_formats())) class ThrottleTestCase(iotests.QMPTestCase): - test_img = "null-aio://" + test_driver = "null-aio" max_drives = 3 def blockstats(self, device): @@ -36,9 +38,14 @@ class ThrottleTestCase(iotests.QMPTestCase): raise Exception("Device not found for blockstats: %s" % device) def setUp(self): + global supported_null_drivers + if self.test_driver not in supported_null_drivers: + # Silently fall back to supported driver + self.test_driver = supported_null_drivers[0] + self.vm = iotests.VM() for i in range(0, self.max_drives): - self.vm.add_drive(self.test_img) + self.vm.add_drive(self.test_driver + "://") self.vm.launch() def tearDown(self): @@ -264,7 +271,7 @@ class ThrottleTestCase(iotests.QMPTestCase): self.assertEqual(self.blockstats('drive1')[0], 4096) class ThrottleTestCoroutine(ThrottleTestCase): - test_img = "null-co://" + test_driver = "null-co" class ThrottleTestGroupNames(iotests.QMPTestCase): max_drives = 3 @@ -426,4 +433,6 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): if __name__ == '__main__': + if 'null-co' not in supported_null_drivers: + iotests.notrun('null-co driver support missing') iotests.main(supported_fmts=["raw"]) -- 2.21.0