Commit 98aa80b2 authored by Dan Winship's avatar Dan Winship

gio/tests/socket: skip IPv6 tests on IPv6-less machines

https://bugzilla.gnome.org/show_bug.cgi?id=667468
parent c67d23aa
......@@ -29,6 +29,8 @@
#include "gnetworkingprivate.h"
static gboolean ipv6_supported;
typedef struct {
GSocket *server;
GSocket *client;
......@@ -338,6 +340,12 @@ test_ipv4_async (void)
static void
test_ipv6_async (void)
{
if (!ipv6_supported)
{
g_test_skip ("No support for IPv6");
return;
}
test_ip_async (G_SOCKET_FAMILY_IPV6);
}
......@@ -420,6 +428,12 @@ test_ipv4_sync (void)
static void
test_ipv6_sync (void)
{
if (!ipv6_supported)
{
g_test_skip ("No support for IPv6");
return;
}
test_ip_sync (G_SOCKET_FAMILY_IPV6);
}
......@@ -546,6 +560,12 @@ test_ipv6_v4mapped (void)
GSocketAddress *addr, *v4addr;
GInetAddress *iaddr;
if (!ipv6_supported)
{
g_test_skip ("No support for IPv6");
return;
}
data = create_server (G_SOCKET_FAMILY_IPV6, v4mapped_server_thread, TRUE);
if (data == NULL)
......@@ -1032,8 +1052,20 @@ int
main (int argc,
char *argv[])
{
GSocket *sock;
g_test_init (&argc, &argv, NULL);
sock = g_socket_new (G_SOCKET_FAMILY_IPV6,
G_SOCKET_TYPE_STREAM,
G_SOCKET_PROTOCOL_DEFAULT,
NULL);
if (sock != NULL)
{
ipv6_supported = TRUE;
g_object_unref (sock);
}
g_test_add_func ("/socket/ipv4_sync", test_ipv4_sync);
g_test_add_func ("/socket/ipv4_async", test_ipv4_async);
g_test_add_func ("/socket/ipv6_sync", test_ipv6_sync);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment