ipv6_v4mapped: force pass even if we don't speak IPv4
authorAntoine Jacoutot <ajacoutot@gnome.org>
Wed, 9 Jan 2013 15:29:29 +0000 (16:29 +0100)
committerAntoine Jacoutot <ajacoutot@gnome.org>
Wed, 9 Jan 2013 15:29:29 +0000 (16:29 +0100)
Some OS (e.g. OpenBSD) do not implement IP v4-mapped addresses. When
this is the case, then we get a "Connection refused", so force the test
to pass to that further tests can run.

https://bugzilla.gnome.org/show_bug.cgi?id=686058

gio/tests/socket.c

index 9c212c8..70bed07 100644 (file)
@@ -105,6 +105,12 @@ create_server (GSocketFamily family,
       fd = g_socket_get_fd (server);
       v6_only = 0;
       setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, &v6_only, sizeof (v6_only));
+      if (! g_socket_speaks_ipv4 (data->server))
+        {
+          g_object_unref (data->server);
+          g_slice_free (IPTestData, data);
+          return NULL;
+        }
     }
 #endif
 
@@ -548,6 +554,12 @@ test_ipv6_v4mapped (void)
 
   data = create_server (G_SOCKET_FAMILY_IPV6, v4mapped_server_thread, TRUE);
 
+  if (data == NULL)
+    {
+      g_test_message ("Test not run: not supported by the OS");
+      return;
+    }
+
   client = g_socket_new (G_SOCKET_FAMILY_IPV4,
                         G_SOCKET_TYPE_STREAM,
                         G_SOCKET_PROTOCOL_DEFAULT,