[glib: 1/2] tests: Add more debug information to gdbus-connection-slow




commit d90d914fc59c4cd0ff116826dc6a5b92f105ce1a
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Jan 7 17:55:21 2021 +0000

    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>

 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);
-      g_assert_no_error (error);
-      g_spawn_check_exit_status (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_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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]