[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 38/43] iotests.py: Add skip_for_formats() decorator
From: |
Kevin Wolf |
Subject: |
[PULL 38/43] iotests.py: Add skip_for_formats() decorator |
Date: |
Wed, 17 Jun 2020 16:49:04 +0200 |
From: Max Reitz <mreitz@redhat.com>
Sometimes, we want to skip some test methods for certain formats. This
decorator allows that.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200617104822.27525-2-mreitz@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/iotests.py | 16 ++++++++++++++++
tests/qemu-iotests/118 | 7 +++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index f20d90f969..5ea4c4df8b 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -1103,6 +1103,22 @@ def skip_if_unsupported(required_formats=(),
read_only=False):
return func_wrapper
return skip_test_decorator
+def skip_for_formats(formats: Sequence[str] = ()) \
+ -> Callable[[Callable[[QMPTestCase, List[Any], Dict[str, Any]], None]],
+ Callable[[QMPTestCase, List[Any], Dict[str, Any]], None]]:
+ '''Skip Test Decorator
+ Skips the test for the given formats'''
+ def skip_test_decorator(func):
+ def func_wrapper(test_case: QMPTestCase, *args: List[Any],
+ **kwargs: Dict[str, Any]) -> None:
+ if imgfmt in formats:
+ msg = f'{test_case}: Skipped for format {imgfmt}'
+ test_case.case_skip(msg)
+ else:
+ func(test_case, *args, **kwargs)
+ return func_wrapper
+ return skip_test_decorator
+
def skip_if_user_is_root(func):
'''Skip Test Decorator
Runs the test only without root permissions'''
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
index adc8a848b5..2350929fd8 100755
--- a/tests/qemu-iotests/118
+++ b/tests/qemu-iotests/118
@@ -683,11 +683,10 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
except OSError:
pass
+ # We need backing file support
+ @iotests.skip_for_formats(('vpc', 'parallels', 'qcow', 'vdi', 'vmdk',
'raw',
+ 'vhdx'))
def test_snapshot_and_commit(self):
- # We need backing file support
- if iotests.imgfmt != 'qcow2' and iotests.imgfmt != 'qed':
- return
-
result = self.vm.qmp('blockdev-snapshot-sync', device='drive0',
snapshot_file=new_img,
format=iotests.imgfmt)
--
2.25.4
- [PULL 31/43] block: consolidate blocksize properties consistency checks, (continued)
- [PULL 31/43] block: consolidate blocksize properties consistency checks, Kevin Wolf, 2020/06/17
- [PULL 32/43] qdev-properties: blocksize: use same limits in code and description, Kevin Wolf, 2020/06/17
- [PULL 27/43] hw/block/nvme: add msix_qsize parameter, Kevin Wolf, 2020/06/17
- [PULL 33/43] qdev-properties: add size32 property type, Kevin Wolf, 2020/06/17
- [PULL 35/43] block: make BlockConf size props 32bit and accept size suffixes, Kevin Wolf, 2020/06/17
- [PULL 28/43] hw/block/nvme: verify msix_init_exclusive_bar() return value, Kevin Wolf, 2020/06/17
- [PULL 30/43] virtio-blk: store opt_io_size with correct size, Kevin Wolf, 2020/06/17
- [PULL 34/43] qdev-properties: make blocksize accept size suffixes, Kevin Wolf, 2020/06/17
- [PULL 37/43] block: lift blocksize property limit to 2 MiB, Kevin Wolf, 2020/06/17
- [PULL 40/43] iotests/292: data_file is unsupported, Kevin Wolf, 2020/06/17
- [PULL 38/43] iotests.py: Add skip_for_formats() decorator,
Kevin Wolf <=
- [PULL 36/43] qdev-properties: add getter for size32 and blocksize, Kevin Wolf, 2020/06/17
- [PULL 39/43] iotests/041: Skip test_small_target for qed, Kevin Wolf, 2020/06/17
- [PULL 42/43] iotests/{190,291}: compat=0.10 is unsupported, Kevin Wolf, 2020/06/17
- [PULL 41/43] iotests/229: data_file is unsupported, Kevin Wolf, 2020/06/17
- [PULL 43/43] iotests: Add copyright line in qcow2.py, Kevin Wolf, 2020/06/17
- Re: [PULL 00/43] Block layer patches, no-reply, 2020/06/17
- Re: [PULL 00/43] Block layer patches, Peter Maydell, 2020/06/18