qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 1/2] tests/qtest: Mute QEMU stderr


From: Fabiano Rosas
Subject: [RFC PATCH 1/2] tests/qtest: Mute QEMU stderr
Date: Thu, 5 Sep 2024 18:03:27 -0300

Make QEMU stderr conditional on the QTEST_LOG variable.

For the /x86/cpuid/parsing-plus-minus test, which traps the stderr, to
continue working set the QTEST_LOG variable from inside the
subprocess.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/libqtest.c              | 6 ++++--
 tests/qtest/test-x86-cpuid-compat.c | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 1326e34291..347664cea6 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -476,11 +476,13 @@ static QTestState *qtest_init_internal(const char 
*qemu_bin,
                          "-display none "
                          "-audio none "
                          "%s"
-                         " -accel qtest",
+                         " -accel qtest"
+                         " 2> %s",
                          socket_path,
                          getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL,
                          qmp_socket_path,
-                         extra_args ?: "");
+                         extra_args ?: "",
+                         getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL);
 
     qtest_client_set_rx_handler(s, qtest_client_socket_recv_line);
     qtest_client_set_tx_handler(s, qtest_client_socket_send);
diff --git a/tests/qtest/test-x86-cpuid-compat.c 
b/tests/qtest/test-x86-cpuid-compat.c
index b9e7e5ef7b..641d1f8740 100644
--- a/tests/qtest/test-x86-cpuid-compat.c
+++ b/tests/qtest/test-x86-cpuid-compat.c
@@ -204,6 +204,9 @@ static void test_plus_minus_subprocess(void)
         return;
     }
 
+    const char *log = g_getenv("QTEST_LOG");
+    g_setenv("QTEST_LOG", "1", true);
+
     /* Rules:
      * 1)"-foo" overrides "+foo"
      * 2) "[+-]foo" overrides "foo=..."
@@ -227,6 +230,9 @@ static void test_plus_minus_subprocess(void)
     g_assert_true(qom_get_bool(path, "sse4-2"));
     g_assert_true(qom_get_bool(path, "sse4.2"));
 
+    if (log) {
+        g_setenv("QTEST_LOG", log, true);
+    }
     qtest_end();
     g_free(path);
 }
-- 
2.35.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]