Merge branch 'test-fixes' into 'main'

tests: Minor fixes to reference and stream-rw_all tests

See merge request GNOME/glib!4540
This commit is contained in:
Philip Withnall
2025-03-06 00:13:41 +00:00
2 changed files with 14 additions and 2 deletions

View File

@@ -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);

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++)