summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-01-19 18:49:06 +0100
committerLudovic Courtès <ludo@gnu.org>2010-01-19 18:49:06 +0100
commitd532c41b91a53a5559de42bf15a3980b8f041677 (patch)
tree4596fe1fefcb1d31651f22dbb505af37475fb05a
parent912a8702466f07ca3f4c673a895361e5d7775b7b (diff)
downloadguile-d532c41b91a53a5559de42bf15a3980b8f041677.tar.gz
Make `sockets.test' more robust.
* test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): Gracefully handle cases where this combination is not supported.
-rw-r--r--test-suite/tests/socket.test12
1 files changed, 9 insertions, 3 deletions
diff --git a/test-suite/tests/socket.test b/test-suite/tests/socket.test
index cc512bf26..7389cee79 100644
--- a/test-suite/tests/socket.test
+++ b/test-suite/tests/socket.test
@@ -1,6 +1,6 @@
;;;; socket.test --- test socket functions -*- scheme -*-
;;;;
-;;;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;;;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 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
@@ -343,7 +343,9 @@
;; testing `bind', `listen' and `connect' on stream-oriented sockets
- (let ((server-socket (socket AF_INET6 SOCK_STREAM 0))
+ (let ((server-socket
+ ;; Some platforms don't support this protocol/family combination.
+ (false-if-exception (socket AF_INET6 SOCK_STREAM 0)))
(server-bound? #f)
(server-listening? #f)
(server-pid #f)
@@ -352,6 +354,8 @@
(client-port 9998))
(pass-if "bind"
+ (if (not server-socket)
+ (throw 'unresolved))
(catch 'system-error
(lambda ()
(bind server-socket AF_INET6 ipv6-addr server-port)
@@ -363,8 +367,10 @@
(else (apply throw args)))))))
(pass-if "bind/sockaddr"
- (let* ((sock (socket AF_INET6 SOCK_STREAM 0))
+ (let* ((sock (false-if-exception (socket AF_INET6 SOCK_STREAM 0)))
(sockaddr (make-socket-address AF_INET6 ipv6-addr client-port)))
+ (if (not sock)
+ (throw 'unresolved))
(catch 'system-error
(lambda ()
(bind sock sockaddr)