[neon/backports-focal/xdg-desktop-portal/Neon/unstable] tests: tests: Increase timeouts when running in CI

Bastien Nocera null at kde.org
Wed Jan 13 06:32:43 GMT 2021


Git commit cbb95e4d643bab5698700892b0d016a43ca2b2d0 by Bastien Nocera.
Committed on 22/04/2020 at 14:15.
Pushed by ash into branch 'Neon/unstable'.

tests: Increase timeouts when running in CI

1 second isn't very much to wait for a D-Bus service in a loaded CI.

M  +7    -3    tests/test-portals.c

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/cbb95e4d643bab5698700892b0d016a43ca2b2d0

diff --git a/tests/test-portals.c b/tests/test-portals.c
index 3446ac1..441b3a3 100644
--- a/tests/test-portals.c
+++ b/tests/test-portals.c
@@ -120,6 +120,7 @@ global_setup (void)
   GQuark portal_errors G_GNUC_UNUSED;
   static gboolean name_appeared;
   guint watch;
+  guint timeout_mult = 1;
 
   update_data_dirs ();
 
@@ -134,6 +135,9 @@ global_setup (void)
   g_test_dbus_add_service_dir (dbus, services);
   g_test_dbus_up (dbus);
 
+  if (g_getenv ("TEST_IN_CI"))
+    timeout_mult = 10;
+
   /* g_test_dbus_up unsets this, so re-set */
   g_setenv ("XDG_RUNTIME_DIR", outdir, TRUE);
 
@@ -166,7 +170,7 @@ global_setup (void)
   backends = g_subprocess_launcher_spawnv (launcher, argv, &error);
   g_assert_no_error (error);
 
-  name_timeout = g_timeout_add (1000, timeout_cb, "Failed to launch test-backends");
+  name_timeout = g_timeout_add (1000 * timeout_mult, timeout_cb, "Failed to launch test-backends");
 
   while (!name_appeared)
     g_main_context_iteration (NULL, TRUE);
@@ -209,7 +213,7 @@ global_setup (void)
   g_assert_no_error (error);
   g_clear_pointer (&argv0, g_free);
 
-  name_timeout = g_timeout_add (1000, timeout_cb, "Failed to launch xdg-desktop-portal");
+  name_timeout = g_timeout_add (1000 * timeout_mult, timeout_cb, "Failed to launch xdg-desktop-portal");
 
   while (!name_appeared)
     g_main_context_iteration (NULL, TRUE);
@@ -249,7 +253,7 @@ global_setup (void)
   portals = g_subprocess_launcher_spawnv (launcher, argv, &error);
   g_assert_no_error (error);
 
-  name_timeout = g_timeout_add (1000, timeout_cb, "Failed to launch xdg-permission-store");
+  name_timeout = g_timeout_add (1000 * timeout_mult, timeout_cb, "Failed to launch xdg-permission-store");
 
   while (!name_appeared)
     g_main_context_iteration (NULL, TRUE);



More information about the Neon-commits mailing list