Tests cannot call g_error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
Bug Description
I stumbled on this writing a new test, using tests/qtest/
g_error() causes SIGTRAP, not SIGABRT, and thus the abort handler doesn't get run.
This in turn means qemu is not killed, which hangs the test because the tap-driver.pl script hangs waiting for more input.
There are a few tests that call g_error().
The SIGABRT handler explicitly kills qemu, e.g.:
qos-test.c:
qtest_
But not unexpectedly there's no such handler for SIGTRAP.
Apply this patch to trigger a repro:
diff --git a/tests/
index fc226fdfeb.
--- a/tests/
+++ b/tests/
@@ -87,6 +87,9 @@ static void e1000e_
/* Wait for TX WB interrupt */
e1000e_
+ g_message("Test g_error hang ...");
+ g_error("Pretend something timed out");
+
/* Check DD bit */
g_
Then:
configure
make
make check-qtest-i386
check-qtest-i386 will take awhile. To repro faster:
$ grep qtest-i386/qos-test Makefile.mtest
.test.name.229 := qtest-i386/qos-test
$ make run-test-229
Running test qtest-i386/qos-test
** Message: 18:40:49.821: Test g_error hang ...
** (tests/
ERROR qtest-i386/qos-test - Bail out! FATAL-ERROR: Pretend something timed out
At this point things are hung because tap-driver.pl is still waiting for input because qemu is still running.
An alternative is of course to allow g_error to be called.
One might restrict tests to not call it, but it might be impractical to impose that on all code that goes into a test.
One will need to find a way to get glib to not call G_BREAKPOINT for this case.
if (debugger_present && breakpoint)
G_BREAKPOINT ();
else
g_abort ();
https:/ /gitlab. gnome.org/ GNOME/glib/ -/blob/ master/ glib/gmessages. c#L555