Fix two tests for G_DEBUG=gc-friendly

This commit is contained in:
Dan Winship 2011-10-11 15:36:42 -04:00
parent 08d6e1147d
commit b3e3914062
2 changed files with 9 additions and 6 deletions

View File

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

View File

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