From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, "John Snow" <jsnow@redhat.com>,
"Denis V. Lunev" <den@openvz.org>,
"Fabiano Rosas" <farosas@suse.de>,
"Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
qemu-block@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <th.huth+qemu@posteo.eu>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
qemu-arm@nongnu.org, "Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Cornelia Huck" <cohuck@redhat.com>,
qemu-s390x@nongnu.org, "Glenn Miles" <milesg@linux.ibm.com>,
qemu-ppc@nongnu.org
Subject: Re: [PATCH v2 02/10] tests/functional: add skipUnlessConfig() helper
Date: Mon, 7 Sep 2026 13:19:21 +0100 [thread overview]
Message-ID: <ap6ryb0M-16t0_6o@redhat.com> (raw)
In-Reply-To: <3f5f77fc-05c9-4b26-8290-28b16dfd3be4@redhat.com>
On Mon, Sep 07, 2026 at 02:02:29PM +0200, Thomas Huth wrote:
> Hi!
>
> On 07/09/2026 12.30, Marc-André Lureau wrote:
> > Read config-host.h and skip tests that rely on some CONFIG_*
> > values.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > tests/functional/qemu_test/__init__.py | 2 +-
> > tests/functional/qemu_test/decorators.py | 25 +++++++++++++++++++++++++
> > 2 files changed, 26 insertions(+), 1 deletion(-)
> >
> > diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
> > index 03e5c73d39dc..e21fa8279281 100644
> > --- a/tests/functional/qemu_test/__init__.py
> > +++ b/tests/functional/qemu_test/__init__.py
> > @@ -16,7 +16,7 @@
> > from .decorators import skipIfMissingCommands, skipIfNotMachine, \
> > skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
> > skipIfMissingImports, skipIfOperatingSystem, skipUnlessOperatingSystem, \
> > - skipLockedMemoryTest, skipIfMissingEnv
> > + skipLockedMemoryTest, skipIfMissingEnv, skipUnlessConfig
> > from .archive import archive_extract
> > from .uncompress import uncompress
> > from .gdb import GDB
> > diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qemu_test/decorators.py
> > index aa135acc7857..7a7d30503440 100644
> > --- a/tests/functional/qemu_test/decorators.py
> > +++ b/tests/functional/qemu_test/decorators.py
> > @@ -10,6 +10,7 @@
> > from unittest import skipIf, skipUnless
> > from .cmd import which
> > +from .config import BUILD_DIR
> > def skipIfMissingEnv(*vars_):
> > @@ -162,6 +163,30 @@ def skipIfMissingImports(*args):
> > return skipUnless(has_imports, 'required import(s) "%s" not installed' %
> > ", ".join(args))
> > +def _read_config_host():
> > + config = set()
> > + with open(BUILD_DIR / "config-host.h", "r") as f:
> > + for line in f:
> > + if line.startswith("#define CONFIG_"):
> > + name = line.split()[1].removeprefix("CONFIG_")
> > + config.add(name)
> > + return config
> > +
> > +_CONFIG_HOST = _read_config_host()
>
> This always reads in config-host.h, also for tests that don't need the
> decorator ... could you change it so that the file is only read (once) if a
> test calls the skipUnlessConfig decorator?
>
> Also I'm a little bit torn whether we really need a decorator for this or
> whether we should rather fence the tests in meson.build instead (similar to
> what we do in tests/qtest/meson.build with config_all_devices.has_key('...')
> already). What do others think about this?
QMP provides a way to query what functionality it exposes, so
it should be possible to query upfront when the "screenshot"
command is exposed or not. So IMHO reading config-host.h is a
a mistake - if it were needed, it would be a sign that QMP
was missing something, because the functional tests should
be thought of the same way as a mgmt application.
Personally I'd not bother trying to query the QMP schema though,
just keep the test written the way it already works, and catch
the QMP error for "CommandNotFound" instead or parsing HMP
output.
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-09-07 12:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 01/10] tests/ahci-test: replace HMP usage with QMP Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 02/10] tests/functional: add skipUnlessConfig() helper Marc-André Lureau
2026-09-07 12:02 ` Thomas Huth
2026-09-07 12:19 ` Daniel P. Berrangé [this message]
2026-09-07 10:30 ` [PATCH v2 03/10] tests/functional: skip if CONFIG_PIXMAN Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 04/10] tests/functional: replace HMP with QMP Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 05/10] tests/functional/s390x: use QMP for balloon Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 06/10] tests/qtest: add qtest_qmp_job_wait() Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 07/10] tests/ide-test: convert to QMP Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 08/10] tests/drive_del-test: compile out HMP-dependent tests when !CONFIG_HMP Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 09/10] qtest: compile out HMP helper " Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 10/10] tests/functional: fix some tests that require HMP Marc-André Lureau
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=ap6ryb0M-16t0_6o@redhat.com \
--to=berrange@redhat.com \
--cc=aurelien@aurel32.net \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=den@openvz.org \
--cc=farman@linux.ibm.com \
--cc=farosas@suse.de \
--cc=jsnow@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=milesg@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=th.huth+qemu@posteo.eu \
--cc=thuth@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.