From d90d914fc59c4cd0ff116826dc6a5b92f105ce1a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 7 Jan 2021 17:55:21 +0000 Subject: [PATCH] tests: Add more debug information to gdbus-connection-slow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gio/tests/gdbus-connection-slow.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gio/tests/gdbus-connection-slow.c b/gio/tests/gdbus-connection-slow.c index 27a6af3c4..7819e669a 100644 --- a/gio/tests/gdbus-connection-slow.c +++ b/gio/tests/gdbus-connection-slow.c @@ -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);