From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Thu, 27 Sep 2012 11:22:56 +0200
Subject: Disable some tests on slow architectures which keep failing the
 tests

[smcv: Modified to use g_test_skip() instead of omitting those test cases
completely, and allow them to be re-enabled with a Debian-specific
environment variable]

Co-authored-by: Simon McVittie <smcv@debian.org>
Forwarded: no
---
 glib/tests/mainloop.c       | 16 ++++++++++++++++
 glib/tests/timeout.c        |  9 +++++++++
 gobject/tests/threadtests.c |  8 ++++++++
 3 files changed, 33 insertions(+)

diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 6748a64..9cf034b 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -524,6 +524,14 @@ test_child_sources (void)
   GMainLoop *loop;
   GSource *parent, *child_b, *child_c, *end;
 
+#if defined(__arm__)
+  if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+    {
+      g_test_skip ("Not reliable on older ARM hardware");
+      return;
+    }
+#endif
+
   ctx = g_main_context_new ();
   loop = g_main_loop_new (ctx, FALSE);
 
@@ -602,6 +610,14 @@ test_recursive_child_sources (void)
   GMainLoop *loop;
   GSource *parent, *child_b, *child_c, *end;
 
+#if defined(__arm__)
+  if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+    {
+      g_test_skip ("Not reliable on older ARM hardware");
+      return;
+    }
+#endif
+
   ctx = g_main_context_new ();
   loop = g_main_loop_new (ctx, FALSE);
 
diff --git a/glib/tests/timeout.c b/glib/tests/timeout.c
index 1ae3f3a..f838c9c 100644
--- a/glib/tests/timeout.c
+++ b/glib/tests/timeout.c
@@ -196,6 +196,15 @@ test_func (gpointer data)
 static void
 test_rounding (void)
 {
+
+#if defined(__arm__)
+  if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+    {
+      g_test_skip ("Not reliable on older ARM hardware");
+      return;
+    }
+#endif
+
   loop = g_main_loop_new (NULL, FALSE);
 
   last_time = g_get_monotonic_time ();
diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c
index 9b923f3..c048f6b 100644
--- a/gobject/tests/threadtests.c
+++ b/gobject/tests/threadtests.c
@@ -482,6 +482,14 @@ test_threaded_toggle_notify (void)
   gsize i;
   const int n_iterations = g_test_thorough () ? 1000000 : 100000;
 
+#if defined(__arm__)
+  if (g_getenv ("DEB_ALLOW_FLAKY_TESTS") == NULL)
+    {
+      g_test_skip ("Not reliable on 32-bit ARM");
+      return;
+    }
+#endif
+
   g_test_bug ("https://gitlab.gnome.org/GNOME/glib/issues/2394");
   g_test_summary ("Test that toggle reference notifications can be changed "
                   "safely from another (the main) thread without causing the "
