diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c index ad88568cb..0e08cd173 100644 --- a/glib/tests/array-test.c +++ b/glib/tests/array-test.c @@ -204,11 +204,10 @@ static gpointer array_large_size_remalloc_impl (gpointer mem, gsize n_bytes) { - /* We only care that g_array_set_size() doesn't hang; we'll never - * actually use any of the 2G of memory that it requests, so it's - * OK that we don't actually allocate the whole thing. + /* We only care that g_array_set_size() doesn't hang before + * calling g_realloc(). So if we got here, we already won. */ - return realloc (mem, MIN (n_bytes, 1024 * 1024)); + exit (0); } static GMemVTable array_large_size_mem_vtable = { @@ -229,7 +228,7 @@ array_large_size (void) { g_mem_set_vtable (&array_large_size_mem_vtable); g_array_set_size (array, 1073750016); - exit (0); /* success */ + g_assert_not_reached (); } g_test_trap_assert_passed (); diff --git a/glib/tests/protocol.c b/glib/tests/protocol.c index 4f888a885..4393f277b 100644 --- a/glib/tests/protocol.c +++ b/glib/tests/protocol.c @@ -138,6 +138,8 @@ test_message (void) int pipes[2]; int passed = 0; int messages = 0; + const char * line_term; + int line_term_len; if (0 > pipe (pipes)) { @@ -166,7 +168,9 @@ test_message (void) g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL); g_assert (g_io_channel_get_line_term (channel, NULL) == NULL); g_io_channel_set_line_term (channel, "\n", 1); - g_assert_cmpstr (g_io_channel_get_line_term (channel, NULL), ==, "\n"); + line_term = g_io_channel_get_line_term (channel, &line_term_len); + g_assert_cmpint (*line_term, ==, '\n'); + g_assert_cmpint (line_term_len, ==, 1); io_source = g_io_add_watch (channel, G_IO_IN, test_message_cb1, tlb); child_source = g_child_watch_add (pid, test_message_cb2, loop);