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;