aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-09-17 11:20:01 +0200
committerMax Reitz <mreitz@redhat.com>2019-10-28 11:22:30 +0100
commit7448be831a6b3a3a7f91d873a52bb2d1ce0bd3d9 (patch)
tree937efaac019f7aa7d853b9061c719f1723f44bce
parente6067a950c44809bbeeb340b2595a5ab844635fd (diff)
downloadqemu-7448be831a6b3a3a7f91d873a52bb2d1ce0bd3d9.zip
qemu-7448be831a6b3a3a7f91d873a52bb2d1ce0bd3d9.tar.gz
qemu-7448be831a6b3a3a7f91d873a52bb2d1ce0bd3d9.tar.bz2
iotests: Let skip_if_unsupported accept a function
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>
-rw-r--r--tests/qemu-iotests/iotests.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index bd867d7..936d33d 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -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))