Qtest patches for 2026-08-19
The following changes since commit fa19879df1658f96ac07365fca8835b7decd6995:
Merge tag 'pull-block-jobs-2026-08-17' of https://gitlab.com/vsementsov/qemu into staging (2026-08-17 15:37:53 -0700)
are available in the Git repository at:
https://gitlab.com/farosas/qemu.git tags/qtest-20260819-pull-request
for you to fetch changes up to bb98963d6df300fe6fc6d2074198e220571cd0cd:
tests/qtest/pxe-test: skip per-row cases whose machine is unavailable (2026-08-19 11:27:58 -0300)
----------------------------------------------------------------
QTest pull request
- Use GLib wrappers during QTEST_LOG parsing
- Skip tests when 'pc' machine is not built in
----------------------------------------------------------------
Amit Machhiwal (1):
tests/qtest/libqtest: Use GLib functions for proper const correctness
Rohitashv Kumar (3):
tests/qtest/device-plug-test: skip pc tests when 'pc' machine is
unavailable
tests/qtest/drive_del-test: skip pc tests when 'pc' machine is
unavailable
tests/qtest/pxe-test: skip per-row cases whose machine is unavailable
tests/qtest/device-plug-test.c | 8 ++++++++ tests/qtest/drive_del-test.c | 16 ++++++++++++++++ tests/qtest/libqtest.c | 9 ++++----- tests/qtest/pxe-test.c | 4 ++++ 4 files changed, 32 insertions(+), 5 deletions(-)
Signature · 1 line
2.53.0
[PULL 4/4] tests/qtest/pxe-test: skip per-row cases whose machine is unavailable
From: Rohitashv Kumar <[email protected]>
The x86 test table mixes 'pc' and 'q35' rows. When QEMU is built without the i440fx/pc machine, the 'pc' rows fail with "unsupported machine type".
Add a per-row qtest_has_machine() check in test_batch(), mirroring the existing per-row qtest_has_device() guard, so rows for an unavailable machine are skipped while the others (e.g. q35) still run.
--- tests/qtest/pxe-test.c | 4 ++++ 1 file changed, 4 insertions(+)
tests/qtest/pxe-test.c +4 -0
@@ -108,6 +108,10 @@ static void test_batch(const testdef_t *tests, bool ipv6)const testdef_t *test = &tests[i];char *testname; +if (!qtest_has_machine (test->machine)) { +continue ; + } +if (!qtest_has_device (test->model)) {continue ; }
Signature · 1 line
2.53.0
[PULL 2/4] tests/qtest/device-plug-test: skip pc tests when 'pc' machine is unavailable
In reply to Fabiano RosasFrom: Rohitashv Kumar <[email protected]>
test_pci_unplug_request() and test_pci_unplug_json_request() use "-machine pc" on i386/x86_64. When QEMU is built without the i440fx/pc machine, these fail with "unsupported machine type 'pc'".
Skip the x86 case when 'pc' is not available. Non-x86 architectures use the default machine and are unaffected, and x86 unplug coverage is still provided by the q35 variant (test_q35_pci_unplug_request), which already guards on qtest_has_machine("q35").
--- tests/qtest/device-plug-test.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tests/qtest/device-plug-test.c +8 -0
@@ -65,6 +65,10 @@ static void test_pci_unplug_request(void) }if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (!qtest_has_machine ("pc" )) { +g_test_skip ("Machine 'pc' is not available" ); +return ; + } machine_addition ="-machine pc" ; }
@@ -107,6 +111,10 @@ static void test_pci_unplug_json_request(void) }if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (!qtest_has_machine ("pc" )) { +g_test_skip ("Machine 'pc' is not available" ); +return ; + } machine_addition ="-machine pc" ; }
Signature · 1 line
2.53.0
[PULL 1/4] tests/qtest/libqtest: Use GLib functions for proper const correctness
In reply to Fabiano RosasFrom: Amit Machhiwal <[email protected]>
While commit e68da5b7a2cd ("tests/qtest: fix discarded const qualifier warning") addressed the immediate strstr() warning by making 'found' const, there's still a room for improvement: getenv() returns char *, but environment strings are semantically read-only and should be treated as const throughout their lifetime.
Replace getenv() with g_getenv() and strstr() with g_strstr_len() to maintain const correctness from source to use. This approach:
- Uses g_getenv() which returns const gchar *, matching the read-only semantics of environment variables
- Employs g_strstr_len() for consistent use of GLib string functions, aligning with QEMU conventions
- Eliminates all const-correctness warnings with strict compilers
--- tests/qtest/libqtest.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tests/qtest/libqtest.c +4 -5
@@ -2151,8 +2151,7 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb)bool qtest_verbose (const char *domain) { -const char *log =getenv ("QTEST_LOG" ); -const char *found; +const gchar *found, *log =g_getenv ("QTEST_LOG" );assert (domain);
@@ -2178,11 +2177,11 @@ bool qtest_verbose(const char *domain)* QTEST_LOG=<domain1>,-<domain2> (only false for domain2) * allows other separators, except - and + */ - found =strstr (log, domain); + found =g_strstr_len (log,-1 , domain);if (found) {/* reject options given twice */ -assert (!strstr (found +strlen (domain), domain)); +assert (!g_strstr_len (found +strlen (domain),-1 , domain));if (found > log) {ptrdiff_t i = found - log -1 ;
@@ -2196,7 +2195,7 @@ bool qtest_verbose(const char *domain)* If filtering out a specific domain, all others are * enabled. */ -return !!strstr (log,"-" ); +return !!g_strstr_len (log,-1 ,"-" ); } }
Signature · 1 line
2.53.0
[PULL 3/4] tests/qtest/drive_del-test: skip pc tests when 'pc' machine is unavailable
In reply to Fabiano RosasFrom: Rohitashv Kumar <[email protected]>
test_cli_device_del(), test_device_add_and_del(), test_drive_add_device_add_and_del() and test_blockdev_add_device_add_and_del() use "-machine pc" on i386/x86_64. When QEMU is built without the i440fx/pc machine, these fail with "unsupported machine type 'pc'".
Skip the x86 case when 'pc' is not available. Non-x86 architectures use the default machine and are unaffected, and the corresponding _q35 variants already cover x86 under qtest_has_machine("q35").
--- tests/qtest/drive_del-test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tests/qtest/drive_del-test.c +16 -0
@@ -258,6 +258,10 @@ static void test_cli_device_del(void) }if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (!qtest_has_machine ("pc" )) { +g_test_skip ("Machine 'pc' is not available" ); +return ; + } machine_addition ="-machine pc" ; }
@@ -332,6 +336,10 @@ static void test_device_add_and_del(void) }if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (!qtest_has_machine ("pc" )) { +g_test_skip ("Machine 'pc' is not available" ); +return ; + } machine_addition ="-machine pc" ; }
@@ -403,6 +411,10 @@ static void test_drive_add_device_add_and_del(void) }if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (!qtest_has_machine ("pc" )) { +g_test_skip ("Machine 'pc' is not available" ); +return ; + } machine_addition ="-machine pc" ; }
@@ -456,6 +468,10 @@ static void test_blockdev_add_device_add_and_del(void) }if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +if (!qtest_has_machine ("pc" )) { +g_test_skip ("Machine 'pc' is not available" ); +return ; + } machine_addition ="-machine pc" ; }
Signature · 1 line
2.53.0
Richard Henderson
Reviewed-byQuoted 10 lines · Fabiano Rosas
The following changes since commit
fa19879df1658f96ac07365fca8835b7decd6995:Merge tag 'pull-block-jobs-2026-08-17' ofhttps://gitlab.com/vsementsov/qemu into staging (2026-08-17 15:37:53 -0700)are available in the Git repository at:
https://gitlab.com/farosas/qemu.git tags/qtest-20260819-pull-requestfor you to fetch changes up to
bb98963d6df300fe6fc6d2074198e220571cd0cd:
Quoted 7 lines
tests/qtest/pxe-test: skip per-row cases whose machine is unavailable (2026-08-19 11:27:58 -0300)----------------------------------------------------------------
QTest pull request- Use GLib wrappers during
QTEST_LOGparsing
- Skip tests when 'pc' machine is not built in
r~