* [PATCH v2 00/10] Make HMP optional - follow-up
@ 2026-09-07 10:30 Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 01/10] tests/ahci-test: replace HMP usage with QMP Marc-André Lureau
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
Hi,
Fix the issues that Peter reported while merging "[GIT PULL 00/50] Make
HMP optional".
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
Changes in v2:
- replaced skipTestIfNoHMP() with more versatile @skipUnlessConfig()
- rebased on staging, added r-b tags
- Link to v1: https://lore.kernel.org/qemu-devel/20260906-nohmp-v1-0-daee96491c43@redhat.com
---
Marc-André Lureau (10):
tests/ahci-test: replace HMP usage with QMP
tests/functional: add skipUnlessConfig() helper
tests/functional: skip if CONFIG_PIXMAN
tests/functional: replace HMP with QMP
tests/functional/s390x: use QMP for balloon
tests/qtest: add qtest_qmp_job_wait()
tests/ide-test: convert to QMP
tests/drive_del-test: compile out HMP-dependent tests when !CONFIG_HMP
qtest: compile out HMP helper when !CONFIG_HMP
tests/functional: fix some tests that require HMP
tests/functional/arm/test_integratorcp.py | 10 +++----
tests/functional/m68k/test_nextcube.py | 8 ++----
tests/functional/mips64el/test_malta.py | 11 ++++----
tests/functional/ppc/test_ppe42.py | 3 +-
tests/functional/qemu_test/__init__.py | 2 +-
tests/functional/qemu_test/decorators.py | 25 ++++++++++++++++
tests/functional/s390x/test_ccw_virtio.py | 4 +--
tests/qtest/ahci-test.c | 5 ++--
tests/qtest/drive_del-test.c | 47 +++++++++++++++----------------
tests/qtest/ide-test.c | 37 ++++++++++++++++++------
tests/qtest/libqtest.c | 39 +++++++++++++++++++++++++
tests/qtest/libqtest.h | 13 +++++++++
12 files changed, 146 insertions(+), 58 deletions(-)
---
base-commit: cacd3462963a0a4f5bab4263ce79c2aa4b32692d
change-id: 20260906-nohmp-1d29f0c7494d
Best regards,
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 01/10] tests/ahci-test: replace HMP usage with QMP
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
@ 2026-09-07 10:30 ` Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 02/10] tests/functional: add skipUnlessConfig() helper Marc-André Lureau
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
Use qemu-io command instead.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/ahci-test.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c
index 3406ca884fb4..eb8d23999738 100644
--- a/tests/qtest/ahci-test.c
+++ b/tests/qtest/ahci-test.c
@@ -1900,8 +1900,7 @@ static void test_write_engine_stop_in_flight(void)
ahci_io(ahci, port, CMD_WRITE_DMA, rx, AHCI_SECTOR_SIZE, 1);
/* Suspend the backend write so the first sector stays in flight. */
- g_free(qtest_hmp(ahci->parent->qts,
- "qemu-io drive0 \"break write_aio wr\""));
+ qtest_qemu_io(ahci->parent->qts, "drive0", "break write_aio wr");
cmd = ahci_command_create(CMD_WRITE_PIO);
ahci_command_adjust(cmd, 0, ptr, bufsize, 0);
@@ -1911,7 +1910,7 @@ static void test_write_engine_stop_in_flight(void)
/* Drop the command list while the write is still outstanding. */
ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
- g_free(qtest_hmp(ahci->parent->qts, "qemu-io drive0 \"resume wr\""));
+ qtest_qemu_io(ahci->parent->qts, "drive0", "resume wr");
/* Round-trip through the device to confirm qemu is still alive. */
ahci_px_rreg(ahci, port, AHCI_PX_TFD);
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 02/10] tests/functional: add skipUnlessConfig() helper
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 ` Marc-André Lureau
2026-09-07 12:02 ` Thomas Huth
2026-09-07 10:30 ` [PATCH v2 03/10] tests/functional: skip if CONFIG_PIXMAN Marc-André Lureau
` (7 subsequent siblings)
9 siblings, 1 reply; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
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()
+
+def skipUnlessConfig(*args):
+ '''
+ Decorator to skip execution of a test if the QEMU build
+ does not have the required CONFIG_* options enabled.
+ Example:
+
+ @skipUnlessConfig("PIXMAN")
+ '''
+ missing = [a for a in args if a not in _CONFIG_HOST]
+ return skipUnless(len(missing) == 0,
+ 'missing build config(s): %s' %
+ ', '.join('CONFIG_' + m for m in missing))
+
def skipLockedMemoryTest(locked_memory):
'''
Decorator to skip execution of a test if the system's
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 03/10] tests/functional: skip if CONFIG_PIXMAN
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 10:30 ` Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 04/10] tests/functional: replace HMP with QMP Marc-André Lureau
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
PIXMAN is required for screendump.
Replace test-time check with earlier @skipUnlessConfig check.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/functional/arm/test_integratorcp.py | 9 ++++-----
tests/functional/m68k/test_nextcube.py | 9 ++++-----
tests/functional/mips64el/test_malta.py | 10 +++++-----
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/tests/functional/arm/test_integratorcp.py b/tests/functional/arm/test_integratorcp.py
index 23ae919359d5..f7551ff7cb88 100755
--- a/tests/functional/arm/test_integratorcp.py
+++ b/tests/functional/arm/test_integratorcp.py
@@ -16,7 +16,7 @@
from qemu_test import QemuSystemTest, Asset
from qemu_test import wait_for_console_pattern
-from qemu_test import skipIfMissingImports, skipUntrustedTest
+from qemu_test import skipIfMissingImports, skipUntrustedTest, skipUnlessConfig
class IntegratorMachine(QemuSystemTest):
@@ -58,6 +58,7 @@ def test_integratorcp_console(self):
wait_for_console_pattern(self, 'Log in as root')
@skipIfMissingImports("numpy", "cv2")
+ @skipUnlessConfig("PIXMAN")
@skipUntrustedTest()
def test_framebuffer_tux_logo(self):
"""
@@ -73,10 +74,8 @@ def test_framebuffer_tux_logo(self):
framebuffer_ready = 'Console: switching to colour frame buffer device'
wait_for_console_pattern(self, framebuffer_ready)
self.vm.cmd('human-monitor-command', command_line='stop')
- res = self.vm.cmd('human-monitor-command',
- command_line='screendump %s' % screendump_path)
- if 'unknown command' in res:
- self.skipTest('screendump not available')
+ self.vm.cmd('human-monitor-command',
+ command_line='screendump %s' % screendump_path)
cpu_count = 1
match_threshold = 0.92
diff --git a/tests/functional/m68k/test_nextcube.py b/tests/functional/m68k/test_nextcube.py
index d917cf5424fe..f38f294bad67 100755
--- a/tests/functional/m68k/test_nextcube.py
+++ b/tests/functional/m68k/test_nextcube.py
@@ -10,10 +10,11 @@
import time
from qemu_test import QemuSystemTest, Asset
-from qemu_test import skipIfMissingImports, skipIfMissingCommands
+from qemu_test import skipIfMissingImports, skipIfMissingCommands, skipUnlessConfig
from qemu_test.tesseract import tesseract_ocr
+@skipUnlessConfig("PIXMAN")
class NextCubeMachine(QemuSystemTest):
timeout = 15
@@ -39,10 +40,8 @@ def check_bootrom_framebuffer(self, screenshot_path):
break
time.sleep(0.1)
- res = self.vm.cmd('human-monitor-command',
- command_line=f"screendump {screenshot_path}")
- if 'unknown command' in res:
- self.skipTest('screendump not available')
+ self.vm.cmd('human-monitor-command',
+ command_line=f"screendump {screenshot_path}")
@skipIfMissingImports("PIL")
def test_bootrom_framebuffer_size(self):
diff --git a/tests/functional/mips64el/test_malta.py b/tests/functional/mips64el/test_malta.py
index 163bbaf5ca36..80fe3424b234 100755
--- a/tests/functional/mips64el/test_malta.py
+++ b/tests/functional/mips64el/test_malta.py
@@ -13,7 +13,8 @@
from qemu_test import LinuxKernelTest, Asset
from qemu_test import exec_command_and_wait_for_pattern
-from qemu_test import skipIfMissingImports, skipFlakyTest, skipUntrustedTest
+from qemu_test import skipIfMissingImports, skipFlakyTest, skipUntrustedTest, \
+ skipUnlessConfig
from mips.test_malta import mips_check_wheezy
@@ -114,6 +115,7 @@ def test_wheezy(self):
@skipIfMissingImports('numpy', 'cv2')
+@skipUnlessConfig("PIXMAN")
class MaltaMachineFramebuffer(LinuxKernelTest):
timeout = 30
@@ -155,10 +157,8 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
framebuffer_ready = 'Console: switching to colour frame buffer device'
self.wait_for_console_pattern(framebuffer_ready)
self.vm.cmd('human-monitor-command', command_line='stop')
- res = self.vm.cmd('human-monitor-command',
- command_line=f'screendump {screendump_path}')
- if 'unknown command' in res:
- self.skipTest('screendump not available')
+ self.vm.cmd('human-monitor-command',
+ command_line=f'screendump {screendump_path}')
match_threshold = 0.95
screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 04/10] tests/functional: replace HMP with QMP
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (2 preceding siblings ...)
2026-09-07 10:30 ` [PATCH v2 03/10] tests/functional: skip if CONFIG_PIXMAN Marc-André Lureau
@ 2026-09-07 10:30 ` Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 05/10] tests/functional/s390x: use QMP for balloon Marc-André Lureau
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
Replace HMP with QMP equivalent.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/functional/arm/test_integratorcp.py | 5 ++---
tests/functional/m68k/test_nextcube.py | 3 +--
tests/functional/mips64el/test_malta.py | 5 ++---
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/tests/functional/arm/test_integratorcp.py b/tests/functional/arm/test_integratorcp.py
index f7551ff7cb88..576c0670bd72 100755
--- a/tests/functional/arm/test_integratorcp.py
+++ b/tests/functional/arm/test_integratorcp.py
@@ -73,9 +73,8 @@ def test_framebuffer_tux_logo(self):
self.boot_integratorcp()
framebuffer_ready = 'Console: switching to colour frame buffer device'
wait_for_console_pattern(self, framebuffer_ready)
- self.vm.cmd('human-monitor-command', command_line='stop')
- self.vm.cmd('human-monitor-command',
- command_line='screendump %s' % screendump_path)
+ self.vm.cmd('stop')
+ self.vm.cmd('screendump', filename=screendump_path)
cpu_count = 1
match_threshold = 0.92
diff --git a/tests/functional/m68k/test_nextcube.py b/tests/functional/m68k/test_nextcube.py
index f38f294bad67..82e157882e0a 100755
--- a/tests/functional/m68k/test_nextcube.py
+++ b/tests/functional/m68k/test_nextcube.py
@@ -40,8 +40,7 @@ def check_bootrom_framebuffer(self, screenshot_path):
break
time.sleep(0.1)
- self.vm.cmd('human-monitor-command',
- command_line=f"screendump {screenshot_path}")
+ self.vm.cmd('screendump', filename=screenshot_path)
@skipIfMissingImports("PIL")
def test_bootrom_framebuffer_size(self):
diff --git a/tests/functional/mips64el/test_malta.py b/tests/functional/mips64el/test_malta.py
index 80fe3424b234..ca001e6fb704 100755
--- a/tests/functional/mips64el/test_malta.py
+++ b/tests/functional/mips64el/test_malta.py
@@ -156,9 +156,8 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
self.vm.launch()
framebuffer_ready = 'Console: switching to colour frame buffer device'
self.wait_for_console_pattern(framebuffer_ready)
- self.vm.cmd('human-monitor-command', command_line='stop')
- self.vm.cmd('human-monitor-command',
- command_line=f'screendump {screendump_path}')
+ self.vm.cmd('stop')
+ self.vm.cmd('screendump', filename=screendump_path)
match_threshold = 0.95
screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 05/10] tests/functional/s390x: use QMP for balloon
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (3 preceding siblings ...)
2026-09-07 10:30 ` [PATCH v2 04/10] tests/functional: replace HMP with QMP Marc-André Lureau
@ 2026-09-07 10:30 ` Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 06/10] tests/qtest: add qtest_qmp_job_wait() Marc-André Lureau
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
Unit is changed from megabytes to bytes.
Reviewed-by: Thomas Huth <th.huth+qemu@posteo.eu>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/functional/s390x/test_ccw_virtio.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/functional/s390x/test_ccw_virtio.py b/tests/functional/s390x/test_ccw_virtio.py
index 1d4958bbe293..f816b1e201a1 100755
--- a/tests/functional/s390x/test_ccw_virtio.py
+++ b/tests/functional/s390x/test_ccw_virtio.py
@@ -162,10 +162,10 @@ def test_s390x_devices(self):
# test the virtio-balloon device
exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo',
'MemTotal: 115640 kB')
- self.vm.cmd('human-monitor-command', command_line='balloon 96')
+ self.vm.cmd('balloon', value=96 * 1024 * 1024)
exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo',
'MemTotal: 82872 kB')
- self.vm.cmd('human-monitor-command', command_line='balloon 128')
+ self.vm.cmd('balloon', value=128 * 1024 * 1024)
exec_command_and_wait_for_pattern(self, 'head -n 1 /proc/meminfo',
'MemTotal: 115640 kB')
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 06/10] tests/qtest: add qtest_qmp_job_wait()
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (4 preceding siblings ...)
2026-09-07 10:30 ` [PATCH v2 05/10] tests/functional/s390x: use QMP for balloon Marc-André Lureau
@ 2026-09-07 10:30 ` Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 07/10] tests/ide-test: convert to QMP Marc-André Lureau
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
Add a helper to wait for job conclusion, used in next changes.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/libqtest.c | 37 +++++++++++++++++++++++++++++++++++++
tests/qtest/libqtest.h | 11 +++++++++++
2 files changed, 48 insertions(+)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 28bb72bfaecf..370f79a3b6fb 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -984,6 +984,43 @@ void qtest_qmp_eventwait(QTestState *s, const char *event)
qobject_unref(response);
}
+void qtest_qmp_job_wait(QTestState *s, const char *job_id)
+{
+ QDict *response, *data, *error;
+ QList *jobs;
+ const QListEntry *entry;
+
+ for (;;) {
+ response = qtest_qmp_eventwait_ref(s, "JOB_STATUS_CHANGE");
+ data = qdict_get_qdict(response, "data");
+ if (!strcmp(qdict_get_str(data, "id"), job_id) &&
+ !strcmp(qdict_get_str(data, "status"), "concluded")) {
+ qobject_unref(response);
+ break;
+ }
+ qobject_unref(response);
+ }
+
+ response = qtest_qmp(s, "{ 'execute': 'query-jobs' }");
+ g_assert(qdict_haskey(response, "return"));
+ jobs = qobject_to(QList, qdict_get(response, "return"));
+ g_assert(jobs);
+ QLIST_FOREACH_ENTRY(jobs, entry) {
+ QDict *job = qobject_to(QDict, qlist_entry_obj(entry));
+ if (!strcmp(qdict_get_str(job, "id"), job_id)) {
+ g_assert_null(qdict_get_try_str(job, "error"));
+ break;
+ }
+ }
+ qobject_unref(response);
+
+ response = qtest_qmp(s,
+ "{ 'execute': 'job-dismiss', 'arguments': { 'id': %s } }", job_id);
+ error = qdict_get_qdict(response, "error");
+ g_assert_null(error);
+ qobject_unref(response);
+}
+
char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
{
char *cmd;
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index 58491ca53ab7..f06e061d214b 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -398,6 +398,17 @@ QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
*/
QDict *qtest_qmp_event_ref(QTestState *s, const char *event);
+/**
+ * qtest_qmp_job_wait:
+ * @s: #QTestState instance to operate on.
+ * @job_id: job identifier to wait for.
+ *
+ * Wait for a QMP job to reach "concluded" status by consuming
+ * JOB_STATUS_CHANGE events, then dismiss the job.
+ * Asserts that the job completed without error.
+ */
+void qtest_qmp_job_wait(QTestState *s, const char *job_id);
+
/**
* qtest_hmp:
* @s: #QTestState instance to operate on.
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 07/10] tests/ide-test: convert to QMP
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (5 preceding siblings ...)
2026-09-07 10:30 ` [PATCH v2 06/10] tests/qtest: add qtest_qmp_job_wait() Marc-André Lureau
@ 2026-09-07 10:30 ` 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
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
The QMP command is explicit, specify both the vmstate and devices.
We use the helper introduced previously to wait for job completion.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/ide-test.c | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c
index 895fec6d0806..cf109b079982 100644
--- a/tests/qtest/ide-test.c
+++ b/tests/qtest/ide-test.c
@@ -1345,11 +1345,34 @@ static void ide_prepare_markers(QTestState *qts, QPCIDevice *dev,
ide_write_marker(qts, dev, ide_bar, 63, CHS_MARKER_DEFAULT);
}
-static void ide_hmp_quiet(QTestState *qts, const char *command)
+static void ide_snapshot_save(QTestState *qts, const char *tag,
+ const char *vmstate, const char *device)
{
- g_autofree char *out = qtest_hmp(qts, "%s", command);
+ qtest_qmp_assert_success(qts,
+ "{ 'execute': 'snapshot-save',"
+ " 'arguments': {"
+ " 'job-id': 'save0',"
+ " 'tag': %s,"
+ " 'vmstate': %s,"
+ " 'devices': [%s]"
+ " }"
+ "}", tag, vmstate, device);
+ qtest_qmp_job_wait(qts, "save0");
+}
- g_assert_cmpstr(out, ==, "");
+static void ide_snapshot_load(QTestState *qts, const char *tag,
+ const char *vmstate, const char *device)
+{
+ qtest_qmp_assert_success(qts,
+ "{ 'execute': 'snapshot-load',"
+ " 'arguments': {"
+ " 'job-id': 'load0',"
+ " 'tag': %s,"
+ " 'vmstate': %s,"
+ " 'devices': [%s]"
+ " }"
+ "}", tag, vmstate, device);
+ qtest_qmp_job_wait(qts, "load0");
}
static char *ide_migration_status(QTestState *qts)
@@ -1455,10 +1478,6 @@ static void test_migrate_chs_snapshot(void)
char marker[9];
int fd;
-#ifndef CONFIG_HMP
- g_test_skip("HMP not enabled");
- return;
-#endif
if (!have_qemu_img()) {
g_test_skip("QTEST_QEMU_IMG not set, snapshots need a qcow2 image");
return;
@@ -1480,13 +1499,13 @@ static void test_migrate_chs_snapshot(void)
/* Snapshot taken while the default translation is in effect */
ide_read_chs_marker(qts, dev, ide_bar, 0, 1, 1, marker);
g_assert_cmpstr(marker, ==, CHS_MARKER_DEFAULT);
- ide_hmp_quiet(qts, "savevm s0");
+ ide_snapshot_save(qts, "s0", "hda", "hda");
ide_set_translation(dev, ide_bar, 8, 32);
ide_read_chs_marker(qts, dev, ide_bar, 0, 1, 1, marker);
g_assert_cmpstr(marker, ==, CHS_MARKER_CUSTOM);
- ide_hmp_quiet(qts, "loadvm s0");
+ ide_snapshot_load(qts, "s0", "hda", "hda");
ide_read_chs_marker(qts, dev, ide_bar, 0, 1, 1, marker);
g_assert_cmpstr(marker, ==, CHS_MARKER_DEFAULT);
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 08/10] tests/drive_del-test: compile out HMP-dependent tests when !CONFIG_HMP
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (6 preceding siblings ...)
2026-09-07 10:30 ` [PATCH v2 07/10] tests/ide-test: convert to QMP Marc-André Lureau
@ 2026-09-07 10:30 ` 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
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
The compiled-out functions are actually testing HMP-specific commands
and behaviour which operate on the old "drive" concept. The QMP
equivalent for block-driver nodes are already tested.
If HMP goes away, those tests should go away too. Compile them out.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/drive_del-test.c | 47 +++++++++++++++++++++-----------------------
1 file changed, 22 insertions(+), 25 deletions(-)
diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index cc52c2d87936..cbf94d5b9f0f 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -87,6 +87,7 @@ static void blockdev_add_with_media(QTestState *qts)
g_assert(has_blockdev(qts));
}
+#ifdef CONFIG_HMP
static void drive_add(QTestState *qts)
{
char *resp = qtest_hmp(qts, "drive_add 0 if=none,id=drive0");
@@ -117,6 +118,7 @@ static void drive_del(QTestState *qts)
g_assert(!has_drive(qts));
g_free(resp);
}
+#endif
/*
* qvirtio_get_dev_type:
@@ -165,13 +167,9 @@ static void device_del(QTestState *qts, bool and_reset)
static void test_drive_without_dev(void)
{
+#ifdef CONFIG_HMP
QTestState *qts;
-#ifndef CONFIG_HMP
- g_test_skip("HMP not enabled");
- return;
-#endif
-
/* Start with an empty drive */
qts = qtest_init("-drive if=none,id=drive0 -M none");
@@ -184,19 +182,18 @@ static void test_drive_without_dev(void)
drive_add(qts);
qtest_quit(qts);
+#else
+ g_test_skip("HMP not enabled");
+#endif
}
static void test_after_failed_device_add(void)
{
+#ifdef CONFIG_HMP
char driver[32];
QDict *response;
QTestState *qts;
-#ifndef CONFIG_HMP
- g_test_skip("HMP not enabled");
- return;
-#endif
-
if (!has_device_builtin("virtio-blk")) {
g_test_skip("Device virtio-blk is not available");
return;
@@ -227,17 +224,16 @@ static void test_after_failed_device_add(void)
drive_add(qts);
qtest_quit(qts);
+#else
+ g_test_skip("HMP not enabled");
+#endif
}
static void test_drive_del_device_del(void)
{
+#ifdef CONFIG_HMP
QTestState *qts;
-#ifndef CONFIG_HMP
- g_test_skip("HMP not enabled");
- return;
-#endif
-
if (!has_device_builtin("virtio-scsi")) {
g_test_skip("Device virtio-scsi is not available");
return;
@@ -259,6 +255,9 @@ static void test_drive_del_device_del(void)
g_assert(!has_drive(qts));
qtest_quit(qts);
+#else
+ g_test_skip("HMP not enabled");
+#endif
}
static void test_cli_device_del(void)
@@ -416,15 +415,11 @@ static void test_device_add_and_del_q35(void)
static void test_drive_add_device_add_and_del(void)
{
+#ifdef CONFIG_HMP
QTestState *qts;
const char *arch = qtest_get_arch();
const char *machine_addition = "";
-#ifndef CONFIG_HMP
- g_test_skip("HMP not enabled");
- return;
-#endif
-
if (!has_device_builtin("virtio-blk")) {
g_test_skip("Device virtio-blk is not available");
return;
@@ -450,17 +445,16 @@ static void test_drive_add_device_add_and_del(void)
g_assert(!has_drive(qts));
qtest_quit(qts);
+#else
+ g_test_skip("HMP not enabled");
+#endif
}
static void test_drive_add_device_add_and_del_q35(void)
{
+#ifdef CONFIG_HMP
QTestState *qts;
-#ifndef CONFIG_HMP
- g_test_skip("HMP not enabled");
- return;
-#endif
-
if (!has_device_builtin("virtio-blk")) {
g_test_skip("Device virtio-blk is not available");
return;
@@ -479,6 +473,9 @@ static void test_drive_add_device_add_and_del_q35(void)
g_assert(!has_drive(qts));
qtest_quit(qts);
+#else
+ g_test_skip("HMP not enabled");
+#endif
}
static void test_blockdev_add_device_add_and_del(void)
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 09/10] qtest: compile out HMP helper when !CONFIG_HMP
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (7 preceding siblings ...)
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 ` Marc-André Lureau
2026-09-07 10:30 ` [PATCH v2 10/10] tests/functional: fix some tests that require HMP Marc-André Lureau
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
This should help prevent introducing HMP tests inadvertently.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/libqtest.c | 2 ++
tests/qtest/libqtest.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 370f79a3b6fb..05d884761540 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1021,6 +1021,7 @@ void qtest_qmp_job_wait(QTestState *s, const char *job_id)
qobject_unref(response);
}
+#ifdef CONFIG_HMP
char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
{
char *cmd;
@@ -1048,6 +1049,7 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...)
va_end(ap);
return ret;
}
+#endif
void qtest_qemu_io(QTestState *s, const char *device,
const char *fmt, ...)
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index f06e061d214b..20982d3fe8dd 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -409,6 +409,7 @@ QDict *qtest_qmp_event_ref(QTestState *s, const char *event);
*/
void qtest_qmp_job_wait(QTestState *s, const char *job_id);
+#ifdef CONFIG_HMP
/**
* qtest_hmp:
* @s: #QTestState instance to operate on.
@@ -434,6 +435,7 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
*/
char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
G_GNUC_PRINTF(2, 0);
+#endif
/**
* qtest_qemu_io:
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 10/10] tests/functional: fix some tests that require HMP
2026-09-07 10:30 [PATCH v2 00/10] Make HMP optional - follow-up Marc-André Lureau
` (8 preceding siblings ...)
2026-09-07 10:30 ` [PATCH v2 09/10] qtest: compile out HMP helper " Marc-André Lureau
@ 2026-09-07 10:30 ` Marc-André Lureau
9 siblings, 0 replies; 13+ messages in thread
From: Marc-André Lureau @ 2026-09-07 10:30 UTC (permalink / raw)
To: qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc, Marc-André Lureau
Those tests use "info registers" command and cannot be converted
easily, for now skip them
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/functional/m68k/test_nextcube.py | 2 +-
tests/functional/ppc/test_ppe42.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/functional/m68k/test_nextcube.py b/tests/functional/m68k/test_nextcube.py
index 82e157882e0a..cd7383f282a1 100755
--- a/tests/functional/m68k/test_nextcube.py
+++ b/tests/functional/m68k/test_nextcube.py
@@ -14,7 +14,7 @@
from qemu_test.tesseract import tesseract_ocr
-@skipUnlessConfig("PIXMAN")
+@skipUnlessConfig("PIXMAN", "HMP")
class NextCubeMachine(QemuSystemTest):
timeout = 15
diff --git a/tests/functional/ppc/test_ppe42.py b/tests/functional/ppc/test_ppe42.py
index 53958a7938d1..a3b8d7fa89f1 100755
--- a/tests/functional/ppc/test_ppe42.py
+++ b/tests/functional/ppc/test_ppe42.py
@@ -7,9 +7,10 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import asyncio
-from qemu_test import QemuSystemTest, Asset
+from qemu_test import QemuSystemTest, Asset, skipUnlessConfig
+@skipUnlessConfig("HMP")
class Ppe42Machine(QemuSystemTest):
timeout = 90
--
2.55.0.543.g5ebe2ebe4ea8
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 02/10] tests/functional: add skipUnlessConfig() helper
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é
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2026-09-07 12:02 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: John Snow, Denis V. Lunev, Fabiano Rosas, Laurent Vivier,
Paolo Bonzini, qemu-block, Peter Maydell, Thomas Huth,
Philippe Mathieu-Daudé, Aurelien Jarno, qemu-arm,
Halil Pasic, Christian Borntraeger, Eric Farman, Matthew Rosato,
Cornelia Huck, qemu-s390x, Daniel P. Berrangé, Glenn Miles,
qemu-ppc
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?
Thomas
> +def skipUnlessConfig(*args):
> + '''
> + Decorator to skip execution of a test if the QEMU build
> + does not have the required CONFIG_* options enabled.
> + Example:
> +
> + @skipUnlessConfig("PIXMAN")
> + '''
> + missing = [a for a in args if a not in _CONFIG_HOST]
> + return skipUnless(len(missing) == 0,
> + 'missing build config(s): %s' %
> + ', '.join('CONFIG_' + m for m in missing))
> +
> def skipLockedMemoryTest(locked_memory):
> '''
> Decorator to skip execution of a test if the system's
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 02/10] tests/functional: add skipUnlessConfig() helper
2026-09-07 12:02 ` Thomas Huth
@ 2026-09-07 12:19 ` Daniel P. Berrangé
0 siblings, 0 replies; 13+ messages in thread
From: Daniel P. Berrangé @ 2026-09-07 12:19 UTC (permalink / raw)
To: Thomas Huth
Cc: Marc-André Lureau, qemu-devel, John Snow, Denis V. Lunev,
Fabiano Rosas, Laurent Vivier, Paolo Bonzini, qemu-block,
Peter Maydell, Thomas Huth, Philippe Mathieu-Daudé,
Aurelien Jarno, qemu-arm, Halil Pasic, Christian Borntraeger,
Eric Farman, Matthew Rosato, Cornelia Huck, qemu-s390x,
Glenn Miles, qemu-ppc
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 :|
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-09-07 12:20 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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é
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
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.