mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
Merge branch 'w32-tests' into 'main'
Fix test suite on Windows See merge request GNOME/glib!2449
This commit is contained in:
commit
d987146fe1
@ -654,7 +654,11 @@ test_internal_enhanced_stdio (void)
|
||||
g_assert_cmpuint (alsize_ps, <, 0x40000000);
|
||||
g_assert_cmpuint (size_ps, >, G_GUINT64_CONSTANT (0xFFFFFFFF));
|
||||
g_assert_cmpuint (statbuf_ps.st_size, >, 0);
|
||||
#if defined(_WIN64)
|
||||
g_assert_cmpuint (statbuf_ps.st_size, ==, G_GUINT64_CONSTANT (0x10000000f));
|
||||
#else
|
||||
g_assert_cmpuint (statbuf_ps.st_size, <=, 0xFFFFFFFF);
|
||||
#endif
|
||||
|
||||
g_object_unref (fi_ps);
|
||||
g_object_unref (gf_ps);
|
||||
|
@ -2243,7 +2243,7 @@ test_credentials_unix_socketpair (void)
|
||||
{
|
||||
gint fds[2];
|
||||
gint status;
|
||||
GSocket *sock;
|
||||
GSocket *sock[2];
|
||||
GError *error = NULL;
|
||||
GCredentials *creds;
|
||||
|
||||
@ -2259,9 +2259,12 @@ test_credentials_unix_socketpair (void)
|
||||
#endif
|
||||
g_assert_cmpint (status, ==, 0);
|
||||
|
||||
sock = g_socket_new_from_fd (fds[0], &error);
|
||||
sock[0] = g_socket_new_from_fd (fds[0], &error);
|
||||
g_assert_no_error (error);
|
||||
sock[1] = g_socket_new_from_fd (fds[1], &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
creds = g_socket_get_credentials (sock, &error);
|
||||
creds = g_socket_get_credentials (sock[0], &error);
|
||||
if (creds != NULL)
|
||||
{
|
||||
gchar *str = g_credentials_to_string (creds);
|
||||
@ -2276,8 +2279,8 @@ test_credentials_unix_socketpair (void)
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_object_unref (sock);
|
||||
g_close (fds[1], NULL);
|
||||
g_object_unref (sock[0]);
|
||||
g_object_unref (sock[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -44,7 +44,7 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _stat32 GStatBuf;
|
||||
|
||||
#elif defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
|
||||
#elif defined(_WIN64)
|
||||
|
||||
typedef struct _stat64 GStatBuf;
|
||||
|
||||
|
@ -100,7 +100,10 @@ test_message_cb1 (GIOChannel * channel,
|
||||
g_test_log_buffer_push (user_data, read_bytes, buf);
|
||||
}
|
||||
|
||||
g_assert_cmpuint (status, ==, G_IO_STATUS_AGAIN);
|
||||
if (status == G_IO_STATUS_EOF)
|
||||
return FALSE;
|
||||
else
|
||||
g_assert_cmpuint (status, ==, G_IO_STATUS_AGAIN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -133,7 +136,6 @@ test_message (void)
|
||||
GMainLoop * loop;
|
||||
GError * error = NULL;
|
||||
gulong child_source;
|
||||
gulong io_source;
|
||||
GPid pid = 0;
|
||||
int pipes[2];
|
||||
int passed = 0;
|
||||
@ -159,6 +161,7 @@ test_message (void)
|
||||
g_error ("error spawning the test: %s", error->message);
|
||||
}
|
||||
|
||||
close (pipes[1]);
|
||||
tlb = g_test_log_buffer_new ();
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
@ -181,7 +184,7 @@ test_message (void)
|
||||
g_assert (g_io_channel_get_encoding (channel) == NULL);
|
||||
g_assert (!g_io_channel_get_buffered (channel));
|
||||
|
||||
io_source = g_io_add_watch (channel, G_IO_IN, test_message_cb1, tlb);
|
||||
g_io_add_watch (channel, G_IO_IN, test_message_cb1, tlb);
|
||||
child_source = g_child_watch_add (pid, test_message_cb2, loop);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
@ -191,7 +194,6 @@ test_message (void)
|
||||
g_test_expect_message ("GLib", G_LOG_LEVEL_CRITICAL, "Source ID*");
|
||||
g_assert (!g_source_remove (child_source));
|
||||
g_test_assert_expected_messages ();
|
||||
g_assert (g_source_remove (io_source));
|
||||
g_io_channel_unref (channel);
|
||||
|
||||
for (msg = g_test_log_buffer_pop (tlb);
|
||||
@ -264,7 +266,6 @@ test_error (void)
|
||||
GMainLoop * loop;
|
||||
GError * error = NULL;
|
||||
gulong child_source;
|
||||
gulong io_source;
|
||||
GPid pid = 0;
|
||||
int pipes[2];
|
||||
|
||||
@ -286,6 +287,7 @@ test_error (void)
|
||||
g_error ("error spawning the test: %s", error->message);
|
||||
}
|
||||
|
||||
close (pipes[1]);
|
||||
tlb = g_test_log_buffer_new ();
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
@ -299,7 +301,7 @@ test_error (void)
|
||||
g_io_channel_set_buffered (channel, FALSE);
|
||||
g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
|
||||
|
||||
io_source = g_io_add_watch (channel, G_IO_IN, test_message_cb1, tlb);
|
||||
g_io_add_watch (channel, G_IO_IN, test_message_cb1, tlb);
|
||||
child_source = g_child_watch_add (pid, test_message_cb2, loop);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
@ -309,7 +311,6 @@ test_error (void)
|
||||
g_test_expect_message ("GLib", G_LOG_LEVEL_CRITICAL, "Source ID*");
|
||||
g_assert (!g_source_remove (child_source));
|
||||
g_test_assert_expected_messages ();
|
||||
g_assert (g_source_remove (io_source));
|
||||
g_io_channel_unref (channel);
|
||||
|
||||
for (msg = g_test_log_buffer_pop (tlb);
|
||||
|
Loading…
Reference in New Issue
Block a user