Merge branch 'fix-once-memcheck-test' into 'main'

tests: Reduce number of threads in once test under valgrind

See merge request GNOME/glib!2729
This commit is contained in:
Philip Withnall 2022-06-21 11:36:50 +00:00
commit 12ed2aa982

View File

@ -22,8 +22,9 @@
*/
#include <glib.h>
#include "../gvalgrind.h"
#if GLIB_SIZEOF_VOID_P > 4
#if GLIB_SIZEOF_VOID_P > 4 && !defined(ENABLE_VALGRIND)
#define THREADS 1000
#else
#define THREADS 100
@ -47,12 +48,12 @@ test_once_single_threaded (void)
g_test_summary ("Test g_once() usage from a single thread");
g_assert (once.status == G_ONCE_STATUS_NOTCALLED);
g_assert_cmpint (once.status, ==, G_ONCE_STATUS_NOTCALLED);
res = g_once (&once, do_once, NULL);
g_assert_cmpint (GPOINTER_TO_INT (res), ==, 1);
g_assert (once.status == G_ONCE_STATUS_READY);
g_assert_cmpint (once.status, ==, G_ONCE_STATUS_READY);
res = g_once (&once, do_once, NULL);
g_assert_cmpint (GPOINTER_TO_INT (res), ==, 1);