[gupnp] tests: In the double bind test, skip if ipv6 fails



commit 8991a9b53fe1be3c6291454bb693e752ad0f1a05
Author: Jens Georg <mail jensge org>
Date:   Wed May 25 20:56:27 2022 +0200

    tests: In the double bind test, skip if ipv6 fails

 tests/test-context.c | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/tests/test-context.c b/tests/test-context.c
index 98ea7d5..7424afb 100644
--- a/tests/test-context.c
+++ b/tests/test-context.c
@@ -290,33 +290,35 @@ test_gupnp_context_error_when_bound ()
         // IPv6
         server = soup_server_new (NULL, NULL);
         soup_server_listen_local (server, 0, SOUP_SERVER_LISTEN_IPV6_ONLY, &error);
-        g_assert_no_error (error);
+        if (error == NULL) {
+                uris = soup_server_get_uris (server);
 
-        uris = soup_server_get_uris (server);
+                address = g_uri_get_host (uris->data);
+                port = g_uri_get_port (uris->data);
 
-        address = g_uri_get_host (uris->data);
-        port = g_uri_get_port (uris->data);
+                g_test_expect_message ("gupnp-context",
+                                       G_LOG_LEVEL_WARNING,
+                                       "*Unable to listen*Could not "
+                                       "listen*Address already in use*");
+                context = g_initable_new (GUPNP_TYPE_CONTEXT,
+                                          NULL,
+                                          &error,
+                                          "host-ip",
+                                          address,
+                                          "port",
+                                          port,
+                                          NULL);
 
-        g_test_expect_message (
-                "gupnp-context",
-                G_LOG_LEVEL_WARNING,
-                "*Unable to listen*Could not listen*Address already in use*");
-        context = g_initable_new (GUPNP_TYPE_CONTEXT,
-                                  NULL,
-                                  &error,
-                                  "host-ip",
-                                  address,
-                                  "port",
-                                  port,
-                                  NULL);
+                g_slist_free_full (uris, (GDestroyNotify) g_uri_unref);
 
-        g_slist_free_full (uris, (GDestroyNotify) g_uri_unref);
+                g_test_assert_expected_messages ();
+                g_assert_error (error,
+                                GUPNP_SERVER_ERROR,
+                                GUPNP_SERVER_ERROR_OTHER);
+                g_assert_null (context);
+                g_clear_error (&error);
+        }
         g_object_unref (server);
-
-        g_test_assert_expected_messages ();
-        g_assert_error (error, GUPNP_SERVER_ERROR, GUPNP_SERVER_ERROR_OTHER);
-        g_assert_null (context);
-        g_clear_error (&error);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]