tests: Skip slow mainloop test on valgrind

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 <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall
2025-07-22 12:20:32 +01:00
parent 89f24b81e0
commit 2f575c38b9

View File

@@ -25,6 +25,7 @@
#include <glib.h>
#include <glib/gstdio.h>
#include "glib-private.h"
#include "gvalgrind.h"
#include <stdio.h>
#include <string.h>
@@ -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;