mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +02:00
Make `sockets.test' more robust.
* test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): Gracefully handle cases where this combination is not supported.
This commit is contained in:
parent
0270d90125
commit
b720f24494
1 changed files with 9 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
;;;; socket.test --- test socket functions -*- scheme -*-
|
;;;; 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
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
;;;; modify it under the terms of the GNU Lesser General Public
|
;;;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -341,7 +341,9 @@
|
||||||
|
|
||||||
;; testing `bind', `listen' and `connect' on stream-oriented sockets
|
;; 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-bound? #f)
|
||||||
(server-listening? #f)
|
(server-listening? #f)
|
||||||
(server-pid #f)
|
(server-pid #f)
|
||||||
|
@ -350,6 +352,8 @@
|
||||||
(client-port 9998))
|
(client-port 9998))
|
||||||
|
|
||||||
(pass-if "bind"
|
(pass-if "bind"
|
||||||
|
(if (not server-socket)
|
||||||
|
(throw 'unresolved))
|
||||||
(catch 'system-error
|
(catch 'system-error
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(bind server-socket AF_INET6 ipv6-addr server-port)
|
(bind server-socket AF_INET6 ipv6-addr server-port)
|
||||||
|
@ -361,8 +365,10 @@
|
||||||
(else (apply throw args)))))))
|
(else (apply throw args)))))))
|
||||||
|
|
||||||
(pass-if "bind/sockaddr"
|
(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)))
|
(sockaddr (make-socket-address AF_INET6 ipv6-addr client-port)))
|
||||||
|
(if (not sock)
|
||||||
|
(throw 'unresolved))
|
||||||
(catch 'system-error
|
(catch 'system-error
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(bind sock sockaddr)
|
(bind sock sockaddr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue