main-loop: Suppress I/O thread warning under qtest

We do not want to display the "I/O thread spun" warning for test cases
that run under qtest. The first attempt for this (commit
01c22f2cdd) tested whether qtest_enabled()
was true.

Commit 21a24302e8 correctly recognized
that just testing qtest_enabled() is not sufficient since there are some
tests that do not use the qtest accelerator but just the qtest character
device, and thus replaced qtest_enabled() by qtest_driver().

However, there are also some tests that only use the qtest accelerator
and not the qtest chardev; perhaps most notably the bash iotests.
Therefore, we have to check both qtest_enabled() and qtest_driver().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20161017180939.27912-1-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Max Reitz 2016-10-17 20:09:39 +02:00 committed by Paolo Bonzini
parent 85cdeb36a4
commit 7d175d29c9

View File

@ -234,7 +234,7 @@ static int os_host_main_loop_wait(int64_t timeout)
if (!timeout && (spin_counter > MAX_MAIN_LOOP_SPIN)) {
static bool notified;
if (!notified && !qtest_driver()) {
if (!notified && !qtest_enabled() && !qtest_driver()) {
fprintf(stderr,
"main-loop: WARNING: I/O thread spun for %d iterations\n",
MAX_MAIN_LOOP_SPIN);