[glib/wip/gcleanup: 63/78] gdbus-connection: Fix race condition in test



commit e6e287e3e359719b72e65936a7fb868381f7c48a
Author: Stef Walter <stefw gnome org>
Date:   Sat Nov 9 09:25:02 2013 +0100

    gdbus-connection: Fix race condition in test
    
    The test was expecting that the spawned process wouldn't start
    up before the NameOwnerChanged signal was subscribed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711805

 gio/tests/gdbus-connection.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c
index fa726e6..a041acb 100644
--- a/gio/tests/gdbus-connection.c
+++ b/gio/tests/gdbus-connection.c
@@ -1000,9 +1000,6 @@ test_connection_filter (void)
   g_assert_cmpint (data.num_handled, ==, 4);
   g_assert_cmpint (data.num_outgoing, ==, 4);
 
-  /* this is safe; testserver will exit once the bus goes away */
-  g_assert (g_spawn_command_line_async (g_test_get_filename (G_TEST_BUILT, "gdbus-testserver", NULL), NULL));
-
   /* wait for service to be available */
   signal_handler_id = g_dbus_connection_signal_subscribe (c,
                                                           "org.freedesktop.DBus", /* sender */
@@ -1015,6 +1012,10 @@ test_connection_filter (void)
                                                           NULL,
                                                           NULL);
   g_assert_cmpint (signal_handler_id, !=, 0);
+
+  /* this is safe; testserver will exit once the bus goes away */
+  g_assert (g_spawn_command_line_async (g_test_get_filename (G_TEST_BUILT, "gdbus-testserver", NULL), NULL));
+
   timeout_mainloop_id = g_timeout_add (30000, test_connection_filter_on_timeout, NULL);
   g_main_loop_run (loop);
   g_source_remove (timeout_mainloop_id);


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