tests: Add more debug information to gdbus-connection-slow

It occasionally fails in CI with output like:
```
196/274 glib:gio / gdbus-connection-slow        FAIL     0.54 s (killed by signal 6 SIGABRT)

--- command ---
G_TEST_BUILDDIR='/builds/pwithnall/glib/_build/gio/tests' G_TEST_SRCDIR='/builds/pwithnall/glib/gio/tests' GIO_MODULE_DIR='' /builds/pwithnall/glib/_build/gio/tests/gdbus-connection-slow
--- stdout ---
\# random seed: R02S4eb186e89e2472eedd11538b37192543
1..2
\# Start of gdbus tests
\# Start of connection tests
Bail out! GLib-GIO:ERROR:../gio/tests/gdbus-connection-slow.c:98:test_connection_flush: assertion failed (error == NULL): Child process killed by signal 11 (g-exec-error-quark, 19)
--- stderr ---
**
GLib-GIO:ERROR:../gio/tests/gdbus-connection-slow.c:98:test_connection_flush: assertion failed (error == NULL): Child process killed by signal 11 (g-exec-error-quark, 19)
cleaning up pid 12991
```

which is not very helpful. Add some more debug output to print the
stdout and stderr of the child process, to hopefully give an insight
into why it’s dying with signal 11 (sigsegv).

I can’t reproduce the sigsegv locally.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2021-01-07 17:55:21 +00:00
parent f22b136b11
commit d90d914fc5

View File

@ -86,17 +86,25 @@ test_connection_flush (void)
gboolean ret;
gint exit_status;
guint timeout_mainloop_id;
gchar *flush_helper_stdout = NULL;
gchar *flush_helper_stderr = NULL;
error = NULL;
ret = g_spawn_command_line_sync (flush_helper,
NULL, /* stdout */
NULL, /* stderr */
&flush_helper_stdout,
&flush_helper_stderr,
&exit_status,
&error);
&error) &&
g_spawn_check_exit_status (exit_status, &error);
if (!ret)
g_test_message ("Child process %s failed. stdout:\n%s\nstderr:\n%s",
flush_helper, flush_helper_stdout, flush_helper_stderr);
g_free (flush_helper_stdout);
g_free (flush_helper_stderr);
g_assert_no_error (error);
g_spawn_check_exit_status (exit_status, &error);
g_assert_no_error (error);
g_assert (ret);
g_assert_true (ret);
timeout_mainloop_id = g_timeout_add (1000, test_connection_flush_on_timeout, GUINT_TO_POINTER (n));
g_main_loop_run (loop);