All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/4] Qtest patches for 2026-08-19
@ 2026-08-19 14:31 Fabiano Rosas
  2026-08-19 14:31 ` [PULL 1/4] tests/qtest/libqtest: Use GLib functions for proper const correctness Fabiano Rosas
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Fabiano Rosas @ 2026-08-19 14:31 UTC (permalink / raw)
  To: qemu-devel

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(-)

-- 
2.53.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL 1/4] tests/qtest/libqtest: Use GLib functions for proper const correctness
  2026-08-19 14:31 [PULL 0/4] Qtest patches for 2026-08-19 Fabiano Rosas
@ 2026-08-19 14:31 ` Fabiano Rosas
  2026-08-19 14:31 ` [PULL 2/4] tests/qtest/device-plug-test: skip pc tests when 'pc' machine is unavailable Fabiano Rosas
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Fabiano Rosas @ 2026-08-19 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amit Machhiwal, Anushree Mathur, Aditya Gupta

From: Amit Machhiwal <amachhiw@linux.ibm.com>

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

Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/libqtest.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index c33c799c92d..bec37c71b8c 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -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, "-");
         }
     }
 
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 2/4] tests/qtest/device-plug-test: skip pc tests when 'pc' machine is unavailable
  2026-08-19 14:31 [PULL 0/4] Qtest patches for 2026-08-19 Fabiano Rosas
  2026-08-19 14:31 ` [PULL 1/4] tests/qtest/libqtest: Use GLib functions for proper const correctness Fabiano Rosas
@ 2026-08-19 14:31 ` Fabiano Rosas
  2026-08-19 14:31 ` [PULL 3/4] tests/qtest/drive_del-test: " Fabiano Rosas
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Fabiano Rosas @ 2026-08-19 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Rohitashv Kumar

From: Rohitashv Kumar <roohiit@amazon.de>

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").

Signed-off-by: Rohitashv Kumar <roohiit@amazon.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/device-plug-test.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 2707ee59f63..650956fa114 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -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";
     }
 
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 3/4] tests/qtest/drive_del-test: skip pc tests when 'pc' machine is unavailable
  2026-08-19 14:31 [PULL 0/4] Qtest patches for 2026-08-19 Fabiano Rosas
  2026-08-19 14:31 ` [PULL 1/4] tests/qtest/libqtest: Use GLib functions for proper const correctness Fabiano Rosas
  2026-08-19 14:31 ` [PULL 2/4] tests/qtest/device-plug-test: skip pc tests when 'pc' machine is unavailable Fabiano Rosas
@ 2026-08-19 14:31 ` Fabiano Rosas
  2026-08-19 14:31 ` [PULL 4/4] tests/qtest/pxe-test: skip per-row cases whose " Fabiano Rosas
  2026-08-19 19:57 ` [PULL 0/4] Qtest patches for 2026-08-19 Richard Henderson
  4 siblings, 0 replies; 6+ messages in thread
From: Fabiano Rosas @ 2026-08-19 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Rohitashv Kumar

From: Rohitashv Kumar <roohiit@amazon.de>

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").

Signed-off-by: Rohitashv Kumar <roohiit@amazon.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/drive_del-test.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c
index 30d9451ddda..4c32da594a4 100644
--- a/tests/qtest/drive_del-test.c
+++ b/tests/qtest/drive_del-test.c
@@ -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";
     }
 
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 4/4] tests/qtest/pxe-test: skip per-row cases whose machine is unavailable
  2026-08-19 14:31 [PULL 0/4] Qtest patches for 2026-08-19 Fabiano Rosas
                   ` (2 preceding siblings ...)
  2026-08-19 14:31 ` [PULL 3/4] tests/qtest/drive_del-test: " Fabiano Rosas
@ 2026-08-19 14:31 ` Fabiano Rosas
  2026-08-19 19:57 ` [PULL 0/4] Qtest patches for 2026-08-19 Richard Henderson
  4 siblings, 0 replies; 6+ messages in thread
From: Fabiano Rosas @ 2026-08-19 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Rohitashv Kumar

From: Rohitashv Kumar <roohiit@amazon.de>

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.

Signed-off-by: Rohitashv Kumar <roohiit@amazon.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/pxe-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
index a3f900fbea3..e85dec5a4e1 100644
--- a/tests/qtest/pxe-test.c
+++ b/tests/qtest/pxe-test.c
@@ -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;
         }
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL 0/4] Qtest patches for 2026-08-19
  2026-08-19 14:31 [PULL 0/4] Qtest patches for 2026-08-19 Fabiano Rosas
                   ` (3 preceding siblings ...)
  2026-08-19 14:31 ` [PULL 4/4] tests/qtest/pxe-test: skip per-row cases whose " Fabiano Rosas
@ 2026-08-19 19:57 ` Richard Henderson
  4 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2026-08-19 19:57 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel

On 8/19/26 07:31, Fabiano Rosas wrote:
> 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-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

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-19 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 14:31 [PULL 0/4] Qtest patches for 2026-08-19 Fabiano Rosas
2026-08-19 14:31 ` [PULL 1/4] tests/qtest/libqtest: Use GLib functions for proper const correctness Fabiano Rosas
2026-08-19 14:31 ` [PULL 2/4] tests/qtest/device-plug-test: skip pc tests when 'pc' machine is unavailable Fabiano Rosas
2026-08-19 14:31 ` [PULL 3/4] tests/qtest/drive_del-test: " Fabiano Rosas
2026-08-19 14:31 ` [PULL 4/4] tests/qtest/pxe-test: skip per-row cases whose " Fabiano Rosas
2026-08-19 19:57 ` [PULL 0/4] Qtest patches for 2026-08-19 Richard Henderson

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.