diff --git a/gio/tests/stream-rw_all.c b/gio/tests/stream-rw_all.c index 4d9035529..64233df4f 100644 --- a/gio/tests/stream-rw_all.c +++ b/gio/tests/stream-rw_all.c @@ -119,10 +119,10 @@ static void test_read_all_async_memory (void) { GInputStream *ms; - gchar b[24] = "0123456789ABCDEFGHIJ!@#$"; + gchar b[] = "0123456789ABCDEFGHIJ!@#$"; gchar buf[10]; - ms = g_memory_input_stream_new_from_data (b, sizeof b, NULL); + ms = g_memory_input_stream_new_from_data (b, strlen (b), NULL); g_input_stream_read_all_async (ms, buf, 10, 0, NULL, read_done, NULL); wait_for_read (TRUE, 10); diff --git a/gobject/tests/reference.c b/gobject/tests/reference.c index 0fe655ea0..0408a8edf 100644 --- a/gobject/tests/reference.c +++ b/gobject/tests/reference.c @@ -1,5 +1,7 @@ #include +#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++)