mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
Fix two tests for G_DEBUG=gc-friendly
This commit is contained in:
parent
08d6e1147d
commit
b3e3914062
@ -204,11 +204,10 @@ static gpointer
|
|||||||
array_large_size_remalloc_impl (gpointer mem,
|
array_large_size_remalloc_impl (gpointer mem,
|
||||||
gsize n_bytes)
|
gsize n_bytes)
|
||||||
{
|
{
|
||||||
/* We only care that g_array_set_size() doesn't hang; we'll never
|
/* We only care that g_array_set_size() doesn't hang before
|
||||||
* actually use any of the 2G of memory that it requests, so it's
|
* calling g_realloc(). So if we got here, we already won.
|
||||||
* OK that we don't actually allocate the whole thing.
|
|
||||||
*/
|
*/
|
||||||
return realloc (mem, MIN (n_bytes, 1024 * 1024));
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GMemVTable array_large_size_mem_vtable = {
|
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_mem_set_vtable (&array_large_size_mem_vtable);
|
||||||
g_array_set_size (array, 1073750016);
|
g_array_set_size (array, 1073750016);
|
||||||
exit (0); /* success */
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
g_test_trap_assert_passed ();
|
g_test_trap_assert_passed ();
|
||||||
|
|
||||||
|
@ -138,6 +138,8 @@ test_message (void)
|
|||||||
int pipes[2];
|
int pipes[2];
|
||||||
int passed = 0;
|
int passed = 0;
|
||||||
int messages = 0;
|
int messages = 0;
|
||||||
|
const char * line_term;
|
||||||
|
int line_term_len;
|
||||||
|
|
||||||
if (0 > pipe (pipes))
|
if (0 > pipe (pipes))
|
||||||
{
|
{
|
||||||
@ -166,7 +168,9 @@ test_message (void)
|
|||||||
g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
|
g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
|
||||||
g_assert (g_io_channel_get_line_term (channel, NULL) == NULL);
|
g_assert (g_io_channel_get_line_term (channel, NULL) == NULL);
|
||||||
g_io_channel_set_line_term (channel, "\n", 1);
|
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);
|
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);
|
child_source = g_child_watch_add (pid, test_message_cb2, loop);
|
||||||
|
Loading…
Reference in New Issue
Block a user