From 24ea83e55e7f74288f65dfefcf11a4e395f6f1d0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 2 Mar 2023 19:03:41 -0500 Subject: [PATCH] Stop using GTestDBus 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 | 25 +------------------------ testsuite/gtk/objects-finalize.c | 11 +---------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/testsuite/gtk/defaultvalue.c b/testsuite/gtk/defaultvalue.c index a82788b7e4..7ed024d312 100644 --- a/testsuite/gtk/defaultvalue.c +++ b/testsuite/gtk/defaultvalue.c @@ -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(); } diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c index 24540e313f..95b565c591 100644 --- a/testsuite/gtk/objects-finalize.c +++ b/testsuite/gtk/objects-finalize.c @@ -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; -- 2.30.2