From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PATCH 1/5] iotests.py: Add skip_for_formats() decorator
Date: Wed, 17 Jun 2020 12:48:18 +0200 [thread overview]
Message-ID: <20200617104822.27525-2-mreitz@redhat.com> (raw)
In-Reply-To: <20200617104822.27525-1-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>
---
tests/qemu-iotests/118 | 7 +++----
tests/qemu-iotests/iotests.py | 13 +++++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
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)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index f20d90f969..92c08b9dc6 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -1103,6 +1103,19 @@ def skip_if_unsupported(required_formats=(), read_only=False):
return func_wrapper
return skip_test_decorator
+def skip_for_formats(formats: Sequence[str] = ()):
+ '''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:
+ test_case.case_skip(f'{test_case}: Skipped for format {imgfmt}')
+ 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'''
--
2.26.2
next prev parent reply other threads:[~2020-06-17 10:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 10:48 [PATCH 0/5] iotests: Some fixes for rarely run cases Max Reitz
2020-06-17 10:48 ` Max Reitz [this message]
2020-06-17 11:37 ` [PATCH 1/5] iotests.py: Add skip_for_formats() decorator Thomas Huth
2020-06-17 10:48 ` [PATCH 2/5] iotests/041: Skip test_small_target for qed Max Reitz
2020-06-17 11:39 ` Thomas Huth
2020-06-17 10:48 ` [PATCH 3/5] iotests/292: data_file is unsupported Max Reitz
2020-06-17 10:48 ` [PATCH 4/5] iotests/229: " Max Reitz
2020-06-17 10:48 ` [PATCH 5/5] iotests/{190,291}: compat=0.10 " Max Reitz
2020-06-17 12:27 ` [PATCH 0/5] iotests: Some fixes for rarely run cases no-reply
2020-06-17 12:52 ` Kevin Wolf
2020-06-17 14:11 ` Max Reitz
2020-06-17 14:19 ` Kevin Wolf
2020-06-17 14:21 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200617104822.27525-2-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).