Skip to contentSkip to conversation

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

PATCH In review Max Reitz 2 participants 2 messages Oct 17, 2016 – Nov 1, 2016

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 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 01c22f2cdd4fcf02276ea10f48253850a5fd7259) tested whether qtest_enabled() was true.

Commit 21a24302e85024dd7b2a151158adbc1f5dc5c4dd 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().

---
 main-loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
main-loop.c +1 -1
index 6a7f8d3..889b5bf 100644
@@ -232,7 +232,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);
Signature · 1 line
2.10.0
#1 lore raw
Quoted 25 lines · Max Reitz

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 01c22f2cdd4fcf02276ea10f48253850a5fd7259) tested whether qtest_enabled() was true.

Commit 21a24302e85024dd7b2a151158adbc1f5dc5c4dd 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().

---
 main-loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
main-loop.c +0 -0
index 6a7f8d3..889b5bf 100644

main-loop.c static int os_host_main_loop_wait(int64_t timeout) · line 238

Quoted 8 lines
main-loop.c +1 -1
@@ -232,7 +232,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);

Finally queued, thanks.

Paolo