Subject: bug#36340: [PATCH 2/2] bug#36340: Disable tests when sockets not provided

From: Michael Gran <[email-masked]>
Date: Sun, 9 Mar 2025 16:55:23 -0700

* test-suite/tests/00-repl-server.test (call-with-repl-server): throw
  unsupported when sockets not provided
* test-suite/tests/web-server.test (expect, "server is listening"):
  throw unresolved when socket not provided
---
 test-suite/tests/00-repl-server.test | 3 ++-
 test-suite/tests/web-server.test     | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/test-suite/tests/00-repl-server.test b/test-suite/tests/00-repl-server.test
index 433181ee6..d90da4faa 100644
--- a/test-suite/tests/00-repl-server.test
+++ b/test-suite/tests/00-repl-server.test
@@ -28,7 +28,8 @@
   "Set up a REPL server in a separate process and call PROC with a
 socket connected to that server."
   ;; The REPL server requires thread. The test requires fork.
-  (unless (and (provided? 'threads) (provided? 'fork) (defined? 'mkdtemp))
+  (unless (and (provided? 'threads) (provided? 'fork) (defined? 'mkdtemp)
+               (provided? 'socket))
     (throw 'unsupported))
 
   (let* ((tmpdir (mkdtemp "/tmp/repl-server-test-XXXXXX"))
diff --git a/test-suite/tests/web-server.test b/test-suite/tests/web-server.test
index d84c47d18..f0458eb3f 100644
--- a/test-suite/tests/web-server.test
+++ b/test-suite/tests/web-server.test
@@ -66,7 +66,7 @@
      (run-server handle-request 'http `(#:port ,%port-number)))))
 
 (define-syntax-rule (expect method path code args ...)
-  (if (provided? 'threads)
+  (if (and (provided? 'threads) (provided? 'socket))
       (let-values (((response body)
                     (method (string-append %server-base-uri path)
                             #:decode-body? #t
@@ -78,7 +78,7 @@
 
 (pass-if "server is listening"
   ;; First, wait until the server is listening, up to a few seconds.
-  (if (provided? 'threads)
+  (if (and (provided? 'threads) (provided? 'socket))
       (let ((socket (socket AF_INET SOCK_STREAM 0)))
         (let loop ((n 1))
           (define success?
@@ -122,7 +122,7 @@
     '("Hello, λ world!"
       "Écrit comme ça en Latin-1."
       "GNU Guile")
-  (if (provided? 'threads)
+  (if (and (provided? 'threads) (provided? 'socket))
       (let ((port (open-socket-for-uri %server-base-uri)))
         (define result
           (map (lambda (path)
-- 
2.48.1