From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Alexander Graf" <agraf@csgraf.de>,
"Phil Dennis-Jordan" <phil@philjordan.eu>,
"Fabiano Rosas" <farosas@suse.de>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH-for-10.0 v3 2/5] tests/functional: Add a decorator for skipping tests on particular OS
Date: Fri, 4 Apr 2025 07:26:16 +0200 [thread overview]
Message-ID: <e92f7d01-8def-4a5c-8910-49197386b63c@redhat.com> (raw)
In-Reply-To: <20250403203241.46692-3-philmd@linaro.org>
On 03/04/2025 22.32, Philippe Mathieu-Daudé wrote:
> Since tests might be failing on some operating systems,
> introduce the skipIfOperatingSystem() decorator.
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> tests/functional/qemu_test/__init__.py | 2 +-
> tests/functional/qemu_test/decorators.py | 15 ++++++++++++++-
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> index 45f7befa374..af41c2c6a22 100644
> --- a/tests/functional/qemu_test/__init__.py
> +++ b/tests/functional/qemu_test/__init__.py
> @@ -15,6 +15,6 @@
> from .linuxkernel import LinuxKernelTest
> from .decorators import skipIfMissingCommands, skipIfNotMachine, \
> skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
> - skipIfMissingImports
> + skipIfMissingImports, skipIfOperatingSystem
> from .archive import archive_extract
> from .uncompress import uncompress
> diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qemu_test/decorators.py
> index 1651eb739a7..50d29de533d 100644
> --- a/tests/functional/qemu_test/decorators.py
> +++ b/tests/functional/qemu_test/decorators.py
> @@ -5,7 +5,7 @@
> import importlib
> import os
> import platform
> -from unittest import skipUnless
> +from unittest import skipIf, skipUnless
>
> from .cmd import which
>
> @@ -26,6 +26,19 @@ def skipIfMissingCommands(*args):
> return skipUnless(has_cmds, 'required command(s) "%s" not installed' %
> ", ".join(args))
>
> +'''
> +Decorator to skip execution of a test if the current
> +host operating system does match one of the prohibited
> +ones.
> +Example
> +
> + @skipIfOperatingSystem("Linux", "Darwin")
> +'''
> +def skipIfOperatingSystem(*args):
> + return skipIf(platform.system() in args,
> + 'running on an OS (%s) that is not able to run this test' %
> + ", ".join(args))
> +
> '''
> Decorator to skip execution of a test if the current
> host machine does not match one of the permitted
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2025-04-04 5:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 20:32 [PATCH-for-10.0 v3 0/5] hw/arm: Tests fixes for 10.0 Philippe Mathieu-Daudé
2025-04-03 20:32 ` [PATCH-for-10.0 v3 1/5] tests/functional/test_aarch64_rme_virt: fix sporadic failure Philippe Mathieu-Daudé
2025-04-03 20:32 ` [PATCH-for-10.0 v3 2/5] tests/functional: Add a decorator for skipping tests on particular OS Philippe Mathieu-Daudé
2025-04-04 5:26 ` Thomas Huth [this message]
2025-04-03 20:32 ` [PATCH-for-10.0 v3 3/5] tests/functional: Skip aarch64_replay test on macOS Philippe Mathieu-Daudé
2025-04-03 20:32 ` [PATCH-for-10.0 v3 4/5] tests/qtest: Skip Aarch64 VMapple machine Philippe Mathieu-Daudé
2025-04-03 20:32 ` [PATCH-for-10.0 v3 5/5] hw/arm: Do not build VMapple machine by default Philippe Mathieu-Daudé
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=e92f7d01-8def-4a5c-8910-49197386b63c@redhat.com \
--to=thuth@redhat.com \
--cc=agraf@csgraf.de \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=phil@philjordan.eu \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).