@@ -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);
@@ -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);
}
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(-)