From 2f575c38b9e05568d1bb596aff1f970a1cb0a95d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 22 Jul 2025 12:20:32 +0100 Subject: [PATCH] tests: Skip slow mainloop test on valgrind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `mainloop` test suite takes about 775s on my machine under valgrind with this test enabled, vs 50s without this test enabled. This causes CI failures like https://gitlab.gnome.org/GNOME/glib/-/jobs/5321882. I’m not sure that valgrind will actually successfully reproduce the race condition because it runs too slowly (but I haven’t verified that by reverting the fix for the race). In any case, you can still choose to run the test under valgrind with `-m thorough`. Signed-off-by: Philip Withnall --- glib/tests/mainloop.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c index b1a21293f..e3c4eb538 100644 --- a/glib/tests/mainloop.c +++ b/glib/tests/mainloop.c @@ -25,6 +25,7 @@ #include #include #include "glib-private.h" +#include "gvalgrind.h" #include #include @@ -2644,6 +2645,16 @@ test_simultaneous_source_context_destruction (void) SimultaneousDestructionTest **test; guint64 i; + /* The race in this test is very hard to reproduce under valgrind, so skip it. + * Otherwise the test can run for tens of minutes. */ +#if defined (ENABLE_VALGRIND) + if (RUNNING_ON_VALGRIND && !g_test_thorough ()) + { + g_test_skip ("Skipping hard-to-reproduce race under valgrind"); + return; + } +#endif + if (g_test_thorough ()) { n_concurrent = 512;