]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
iotests: Let skip_if_unsupported accept a function
authorMax Reitz <mreitz@redhat.com>
Tue, 17 Sep 2019 09:20:01 +0000 (11:20 +0200)
committerMax Reitz <mreitz@redhat.com>
Mon, 28 Oct 2019 10:22:30 +0000 (11:22 +0100)
This lets tests use skip_if_unsupported() with a potentially variable
list of required formats.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190917092004.999-5-mreitz@redhat.com
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
tests/qemu-iotests/iotests.py

index bd867d7e020a3e9aca437d3ec770a483810c4ea0..936d33df6110b5f2434827fd5030118522e95f31 100644 (file)
@@ -930,8 +930,12 @@ def skip_if_unsupported(required_formats=[], read_only=False):
        Runs the test if all the required formats are whitelisted'''
     def skip_test_decorator(func):
         def func_wrapper(test_case: QMPTestCase, *args, **kwargs):
-            usf_list = list(set(required_formats) -
-                            set(supported_formats(read_only)))
+            if callable(required_formats):
+                fmts = required_formats(test_case)
+            else:
+                fmts = required_formats
+
+            usf_list = list(set(fmts) - set(supported_formats(read_only)))
             if usf_list:
                 test_case.case_skip('{}: formats {} are not whitelisted'.format(
                     test_case, usf_list))