diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-11 18:32:22 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-13 14:25:14 +0000 |
commit | d30d68dbb9e013cd002923608d34b8af3e1fe522 (patch) | |
tree | b0f615e676a3c1ce16917d34cf7640975b1989fc | |
parent | bb9a39a0658a9e41e221b857fa7ccaf1d72242e1 (diff) |
tests: relax assertion that user_data is freed immediatelygdbus-prep2
In GDBus, every call back to user code comes through an idle, to
improve thread-safety.
-rw-r--r-- | tests/dbus/disconnection.c | 38 | ||||
-rw-r--r-- | tests/dbus/unsupported-interface.c | 5 |
2 files changed, 33 insertions, 10 deletions
diff --git a/tests/dbus/disconnection.c b/tests/dbus/disconnection.c index 5f3ff5247..edf2dfe44 100644 --- a/tests/dbus/disconnection.c +++ b/tests/dbus/disconnection.c @@ -364,15 +364,29 @@ main (int argc, g_error_free (error_out); error_out = NULL; - /* Now that the main loop has run, cancelled signal connections have been - * freed */ - MYASSERT (tp_intset_is_member (freed_user_data, TEST_B), ""); - MYASSERT (tp_intset_is_member (freed_user_data, TEST_C), ""); - MYASSERT (tp_intset_is_member (freed_user_data, TEST_D), ""); - MYASSERT (tp_intset_is_member (freed_user_data, TEST_E), ""); - MYASSERT (tp_intset_is_member (freed_user_data, TEST_F), ""); - MYASSERT (tp_intset_is_member (freed_user_data, TEST_G), ""); - MYASSERT (tp_intset_is_member (freed_user_data, TEST_H), ""); + /* It might take a little longer to free all the user-data, because it + * happens in an idle */ + + while (!tp_intset_is_member (freed_user_data, TEST_B)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_C)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_D)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_E)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_F)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_G)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_H)) + g_main_context_iteration (NULL, TRUE); /* both A and Z are still listening for signals, so their user data is * still held */ @@ -390,6 +404,12 @@ main (int argc, tp_tests_assert_last_unref (&f->proxies[TEST_H]); tp_tests_assert_last_unref (&f->proxies[TEST_Z]); + while (!tp_intset_is_member (freed_user_data, TEST_A)) + g_main_context_iteration (NULL, TRUE); + + while (!tp_intset_is_member (freed_user_data, TEST_Z)) + g_main_context_iteration (NULL, TRUE); + /* we should already have checked each of these at least once, but just to * make sure we have a systematic test that all user data is freed... */ MYASSERT (tp_intset_is_member (freed_user_data, TEST_A), ""); diff --git a/tests/dbus/unsupported-interface.c b/tests/dbus/unsupported-interface.c index 818e40f2e..7ff94d777 100644 --- a/tests/dbus/unsupported-interface.c +++ b/tests/dbus/unsupported-interface.c @@ -196,7 +196,10 @@ test_supported_signal (Fixture *f, g_assert (!f->freed); tp_proxy_signal_connection_disconnect (sc); - g_assert (f->freed); + + /* GDBus invokes destructors in an idle */ + while (!f->freed) + g_main_context_iteration (NULL, TRUE); } static void |