Stop using GTestDBus
authorMatthias Clasen <mclasen@redhat.com>
Fri, 3 Mar 2023 00:03:41 +0000 (19:03 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 3 Mar 2023 00:18:34 +0000 (19:18 -0500)
It is causing tests to timeout when libraries we are using
leak bus connections, and it turns out our tests run fine
without a session bus.

Backport of 1b265a7971171.

testsuite/gtk/defaultvalue.c
testsuite/gtk/objects-finalize.c

index a82788b7e4da586ed281687a2d3368b5fb1fdf6f..7ed024d31296ed3c3936849d8a8b9af837a8f577 100644 (file)
@@ -458,9 +458,6 @@ main (int argc, char **argv)
   const GType *otypes;
   guint i;
   gchar *schema_dir;
-  GTestDBus *bus;
-  GMainLoop *loop;
-  gint result;
 
   /* These must be set before before gtk_test_init */
   g_setenv ("GIO_USE_VFS", "local", TRUE);
@@ -475,12 +472,6 @@ main (int argc, char **argv)
   if (g_getenv ("GTK_TEST_MESON") == NULL)
     g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);
 
-  /* Create one test bus for all tests, as we have a lot of very small
-   * and quick tests.
-   */
-  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
-  g_test_dbus_up (bus);
-
   otypes = gtk_test_list_all_types (NULL);
   for (i = 0; otypes[i]; i++)
     {
@@ -497,19 +488,5 @@ main (int argc, char **argv)
       g_free (testname);
     }
 
-  result = g_test_run();
-
-  /* Work around the annoying issue that g_test_dbus_down is giving
-   * us an "Error while sending AddMatch" that comes out of an idle
-   */
-  loop = g_main_loop_new (NULL, FALSE);
-  g_timeout_add (1000, (GSourceFunc)g_main_loop_quit, loop);
-  g_main_loop_run (loop);
-  g_main_loop_unref (loop);
-
-  g_test_dbus_down (bus);
-  g_object_unref (bus);
-  g_free (schema_dir);
-
-  return result;
+  return g_test_run();
 }
index 24540e313fb30b81c952bba5145da71308a7ef3e..95b565c59133c8a3fd4e95b3e31ef81fb7b90e5e 100644 (file)
@@ -79,8 +79,7 @@ main (int argc, char **argv)
   const GType *all_types;
   guint n_types = 0, i;
   gchar *schema_dir;
-  GTestDBus *bus;
-  gint result;
+  int result;
 
   /* These must be set before before gtk_test_init */
   g_setenv ("GIO_USE_VFS", "local", TRUE);
@@ -95,12 +94,6 @@ main (int argc, char **argv)
   if (g_getenv ("GTK_TEST_MESON") == NULL)
     g_setenv ("GSETTINGS_SCHEMA_DIR", schema_dir, TRUE);
 
-  /* Create one test bus for all tests, as we have a lot of very small
-   * and quick tests.
-   */
-  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
-  g_test_dbus_up (bus);
-
   all_types = gtk_test_list_all_types (&n_types);
 
   for (i = 0; i < n_types; i++)
@@ -133,8 +126,6 @@ main (int argc, char **argv)
 
   result = g_test_run();
 
-  g_test_dbus_down (bus);
-  g_object_unref (bus);
   g_free (schema_dir);
 
   return result;