[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/03: tests: Skip web server tests when thread support
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 02/03: tests: Skip web server tests when thread support is missing. |
Date: |
Sun, 16 Jul 2023 16:06:23 -0400 (EDT) |
civodul pushed a commit to branch main
in repository guile.
commit aa44ad3fb85172952bc4d7a6780b3af07f380db0
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Jul 16 21:47:44 2023 +0200
tests: Skip web server tests when thread support is missing.
* test-suite/tests/web-server.test ("server is listening"): Throw to
'unresolved when not (provided? 'threads).
---
test-suite/tests/web-server.test | 42 +++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/test-suite/tests/web-server.test b/test-suite/tests/web-server.test
index f5081889f..d84c47d18 100644
--- a/test-suite/tests/web-server.test
+++ b/test-suite/tests/web-server.test
@@ -1,6 +1,6 @@
;;;; web-server.test --- HTTP server -*- mode: scheme; coding: utf-8; -*-
;;;;
-;;;; Copyright (C) 2019-2020, 2022 Free Software Foundation, Inc.
+;;;; Copyright (C) 2019-2020, 2022, 2023 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -78,26 +78,28 @@
(pass-if "server is listening"
;; First, wait until the server is listening, up to a few seconds.
- (let ((socket (socket AF_INET SOCK_STREAM 0)))
- (let loop ((n 1))
- (define success?
- (catch 'system-error
- (lambda ()
- (format (current-error-port)
- "connecting to the server, attempt #~a~%" n)
- (connect socket AF_INET INADDR_LOOPBACK %port-number)
- (close-port socket)
- #t)
- (lambda args
- (if (and (= ECONNREFUSED (system-error-errno args))
- (<= n 15))
- #f
- (apply throw args)))))
+ (if (provided? 'threads)
+ (let ((socket (socket AF_INET SOCK_STREAM 0)))
+ (let loop ((n 1))
+ (define success?
+ (catch 'system-error
+ (lambda ()
+ (format (current-error-port)
+ "connecting to the server, attempt #~a~%" n)
+ (connect socket AF_INET INADDR_LOOPBACK %port-number)
+ (close-port socket)
+ #t)
+ (lambda args
+ (if (and (= ECONNREFUSED (system-error-errno args))
+ (<= n 15))
+ #f
+ (apply throw args)))))
- (or success?
- (begin
- (sleep 1)
- (loop (+ n 1)))))))
+ (or success?
+ (begin
+ (sleep 1)
+ (loop (+ n 1))))))
+ (throw 'unresolved)))
(pass-if-equal "GET /"
"Hello, λ world!"