tests: Use g_test_skip_printf()

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2021-08-05 11:51:46 +01:00
parent 182d9995ca
commit 26fbd14954
2 changed files with 13 additions and 46 deletions

View File

@ -341,9 +341,7 @@ test_ip_async (GSocketFamily family)
data = create_server (family, echo_server_thread, FALSE, &error); data = create_server (family, echo_server_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -454,9 +452,7 @@ test_ip_sync (GSocketFamily family)
data = create_server (family, echo_server_thread, FALSE, &error); data = create_server (family, echo_server_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -594,9 +590,7 @@ test_ip_sync_dgram (GSocketFamily family)
echo_server_dgram_thread, FALSE, &error); echo_server_dgram_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -974,9 +968,7 @@ test_close_graceful (void)
data = create_server (family, graceful_server_thread, FALSE, &error); data = create_server (family, graceful_server_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -1084,9 +1076,7 @@ test_ipv6_v4mapped (void)
data = create_server (G_SOCKET_FAMILY_IPV6, v4mapped_server_thread, TRUE, &error); data = create_server (G_SOCKET_FAMILY_IPV6, v4mapped_server_thread, TRUE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -1145,9 +1135,7 @@ test_timed_wait (void)
data = create_server (G_SOCKET_FAMILY_IPV4, echo_server_thread, FALSE, &error); data = create_server (G_SOCKET_FAMILY_IPV4, echo_server_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -1232,9 +1220,7 @@ test_fd_reuse (void)
data = create_server (G_SOCKET_FAMILY_IPV4, echo_server_thread, FALSE, &error); data = create_server (G_SOCKET_FAMILY_IPV4, echo_server_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -1938,9 +1924,7 @@ test_credentials_tcp_client (void)
data = create_server (family, echo_server_thread, FALSE, &error); data = create_server (family, echo_server_thread, FALSE, &error);
if (error != NULL) if (error != NULL)
{ {
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message); g_test_skip_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
g_clear_error (&error); g_clear_error (&error);
return; return;
} }
@ -2045,13 +2029,9 @@ test_credentials_tcp_server (void)
goto beach; goto beach;
skip: skip:
{ g_test_skip_printf ("Failed to create server: %s", error->message);
gchar *message = g_strdup_printf ("Failed to create server: %s", error->message);
g_test_skip (message);
g_free (message);
goto beach; goto beach;
}
beach: beach:
{ {
g_clear_error (&error); g_clear_error (&error);

View File

@ -111,11 +111,7 @@ test_trash_symlinks (void)
if (!g_file_test (target, G_FILE_TEST_IS_DIR)) if (!g_file_test (target, G_FILE_TEST_IS_DIR))
{ {
gchar *message; g_test_skip_printf ("Directory '%s' does not exist", target);
message = g_strdup_printf ("Directory '%s' does not exist", target);
g_test_skip (message);
g_free (message);
g_free (target); g_free (target);
return; return;
} }
@ -124,12 +120,7 @@ test_trash_symlinks (void)
if (target_mount == NULL) if (target_mount == NULL)
{ {
gchar *message; g_test_skip_printf ("Unable to determine mount point for %s", target);
message = g_strdup_printf ("Unable to determine mount point for %s",
target);
g_test_skip (message);
g_free (message);
g_free (target); g_free (target);
return; return;
} }
@ -144,11 +135,7 @@ test_trash_symlinks (void)
if (tmp_mount == NULL) if (tmp_mount == NULL)
{ {
gchar *message; g_test_skip_printf ("Unable to determine mount point for %s", tmp);
message = g_strdup_printf ("Unable to determine mount point for %s", tmp);
g_test_skip (message);
g_free (message);
g_unix_mount_free (target_mount); g_unix_mount_free (target_mount);
g_free (target); g_free (target);
g_free (tmp); g_free (tmp);