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 1b265a7971.
This commit is contained in:
Matthias Clasen 2023-03-02 19:03:41 -05:00
parent e2f2076bf2
commit 24ea83e55e
2 changed files with 2 additions and 34 deletions

View 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();
}

View 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;