tests: Skip a hard-to-reproduce race in reference tests under valgrind

Fixes test timeouts like this one:
https://gitlab.gnome.org/GNOME/glib/-/jobs/4827270

The race will continue to be reproduced when running the tests not under
valgrind.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2025-03-04 12:43:44 +00:00
parent 84f555a3aa
commit 4d566e47d7
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA

View File

@ -1,5 +1,7 @@
#include <glib-object.h>
#include "gvalgrind.h"
static void
test_fundamentals (void)
{
@ -952,6 +954,16 @@ test_weak_ref_concurrent (gconstpointer testdata)
ConcurrentThreadData thread_data[CONCURRENT_N_THREADS];
GWeakRef weak_ref = { 0 };
/* 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_skip ("Skipping hard-to-reproduce race under valgrind");
return;
}
#endif
/* Let several threads call g_weak_ref_set() & g_weak_ref_get() in a loop. */
for (i = 0; i < CONCURRENT_N_OBJS; i++)