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
This commit is contained in:
Stef Walter 2013-11-09 09:25:02 +01:00 committed by Matthias Clasen
parent 65da592249
commit 5a5aaa203a

View File

@ -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);