Skip to content

Commit

Permalink
tests/qtest: Don't print messages from query instances
Browse files Browse the repository at this point in the history
Now that we can query more than one binary, the "starting QEMU..."
message can get a little noisy. Mute those messages unless we're
running with --verbose.

Only affects qtest_init() calls from within libqtest. The tests
continue to output as usual.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Message-ID: <20231018192741.25885-13-farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
  • Loading branch information
Fabiano Rosas authored and Juan Quintela committed Oct 20, 2023
1 parent 6c6d233 commit 7789331
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/qtest/libqtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct QTestState

static GHookList abrt_hooks;
static void (*sighandler_old)(int);
static bool silence_spawn_log;

static int qtest_query_target_endianness(QTestState *s);

Expand Down Expand Up @@ -405,7 +406,9 @@ static QTestState *G_GNUC_PRINTF(2, 3) qtest_spawn_qemu(const char *qemu_bin,

qtest_add_abrt_handler(kill_qemu_hook_func, s);

g_test_message("starting QEMU: %s", command->str);
if (!silence_spawn_log) {
g_test_message("starting QEMU: %s", command->str);
}

#ifndef _WIN32
s->qemu_pid = fork();
Expand Down Expand Up @@ -1508,6 +1511,8 @@ static struct MachInfo *qtest_get_machines(const char *var)
return machines;
}

silence_spawn_log = !g_test_verbose();

qts = qtest_init_with_env(qemu_var, "-machine none");
response = qtest_qmp(qts, "{ 'execute': 'query-machines' }");
g_assert(response);
Expand Down Expand Up @@ -1539,6 +1544,8 @@ static struct MachInfo *qtest_get_machines(const char *var)
qtest_quit(qts);
qobject_unref(response);

silence_spawn_log = false;

memset(&machines[idx], 0, sizeof(struct MachInfo)); /* Terminating entry */
return machines;
}
Expand Down

0 comments on commit 7789331

Please sign in to comment.