[glib/wip/pwithnall/gdbus-names-livelock] tests: Add some missing main context iterations to gdbus-names



commit 323c5d7e214b3baf289eaeda844bdf0d04cdfd0e
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Jun 21 14:16:03 2021 +0100

    tests: Add some missing main context iterations to gdbus-names
    
    These were missing from the test before the previous commit ported from
    `GMainLoop` to `GMainContext`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/gdbus-names.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/gio/tests/gdbus-names.c b/gio/tests/gdbus-names.c
index 81f70f4eb..f20505f43 100644
--- a/gio/tests/gdbus-names.c
+++ b/gio/tests/gdbus-names.c
@@ -773,7 +773,11 @@ test_bus_watch_name (gconstpointer d)
 
   g_assert_cmpint (data.num_appeared, ==, 0);
   g_assert_cmpint (data.num_vanished, ==, 1);
+
   g_bus_unwatch_name (id);
+  while (data.num_free_func < 1)
+    g_main_context_iteration (main_context, TRUE);
+
   g_assert_cmpint (data.num_appeared, ==, 0);
   g_assert_cmpint (data.num_vanished, ==, 1);
   g_assert_cmpint (data.num_free_func, ==, 1);
@@ -845,6 +849,9 @@ test_bus_watch_name (gconstpointer d)
    * Unwatch the name.
    */
   g_bus_unwatch_name (id);
+  while (data.num_free_func < 1)
+    g_main_context_iteration (main_context, TRUE);
+
   g_assert_cmpint (data.num_free_func, ==, 1);
 
   /* unown the name */
@@ -952,7 +959,11 @@ test_bus_watch_name (gconstpointer d)
       g_assert_cmpint (own_data.num_lost, ==, 0);
       g_assert_cmpint (data.num_vanished, ==, 1);
     }
+
   g_bus_unwatch_name (id);
+  while (data.num_free_func < 1)
+    g_main_context_iteration (main_context, TRUE);
+
   g_assert_cmpint (data.num_free_func, ==, 1);
 
   if (!watch_name_test->existing_service)


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