[libsoup/wip/ci-test] Support running tests without ipv6




commit 402235d2973418a5da1367cc1577da403620d059
Author: Patrick Griffis <pgriffis igalia com>
Date:   Thu Nov 26 11:27:51 2020 -0600

    Support running tests without ipv6

 .gitlab-ci.yml      | 2 +-
 tests/server-test.c | 5 +++++
 tests/test-utils.c  | 9 +++++++--
 3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8e3dfa4c..bed976a4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -47,9 +47,9 @@ fedora-asan:
   stage: build
   tags:
     - asan
-    - ipv6
   variables:
     ASAN_OPTIONS: fast_unwind_on_malloc=0
+    SOUP_TEST_NO_IPV6: 1
   script:
     - meson _build -Dauto-features=enabled -Db_sanitize=address -Dintrospection=disabled -Dvapi=disabled
     - ninja -C _build test
diff --git a/tests/server-test.c b/tests/server-test.c
index c2f79ed2..ef77fa00 100644
--- a/tests/server-test.c
+++ b/tests/server-test.c
@@ -385,6 +385,11 @@ do_ipv6_test (ServerData *sd, gconstpointer test_data)
 
        g_test_bug ("666399");
 
+        if (g_getenv ("SOUP_TEST_NO_IPV6")) {
+                g_test_skip ("IPV6 disabled");
+                return;
+        }
+
        sd->server = soup_test_server_new (SOUP_TEST_SERVER_NO_DEFAULT_LISTENER);
        server_add_handler (sd, NULL, ipv6_server_callback, NULL, NULL);
 
diff --git a/tests/test-utils.c b/tests/test-utils.c
index de6479a0..27734d8b 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -385,8 +385,12 @@ static void
 server_listen (SoupServer *server)
 {
        GError *error = NULL;
+        SoupServerListenOptions options = 0;
 
-       soup_server_listen_local (server, 0, 0, &error);
+        if (g_getenv ("SOUP_TEST_NO_IPV6"))
+                options = SOUP_SERVER_LISTEN_IPV4_ONLY;
+
+       soup_server_listen_local (server, 0, options, &error);
        if (error) {
                g_printerr ("Unable to create server: %s\n", error->message);
                exit (1);
@@ -510,7 +514,8 @@ add_listener (SoupServer *server, const char *scheme, const char *host)
 
        if (!g_strcmp0 (scheme, "https"))
                options |= SOUP_SERVER_LISTEN_HTTPS;
-       if (!g_strcmp0 (host, "127.0.0.1"))
+
+       if (!g_strcmp0 (host, "127.0.0.1") || g_getenv ("SOUP_TEST_NO_IPV6"))
                options |= SOUP_SERVER_LISTEN_IPV4_ONLY;
        else if (!g_strcmp0 (host, "::1"))
                options |= SOUP_SERVER_LISTEN_IPV6_ONLY;


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