summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/014/dgram-stream.tl11
-rw-r--r--tests/common.tl4
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/014/dgram-stream.tl b/tests/014/dgram-stream.tl
index feb272ba..b2ac1165 100644
--- a/tests/014/dgram-stream.tl
+++ b/tests/014/dgram-stream.tl
@@ -1,3 +1,4 @@
+(load "../common.tl")
(load "../sock-common.tl")
(defvar family)
@@ -20,7 +21,7 @@
(print nil cli-sock)
(flush-stream cli-sock)))
-(defun test ()
+(defun dgram-test ()
(let* ((svc-sock (open-socket family sock-dgram))
(svc-addr (bindfree svc-sock 1025 65535))
(server-pid (fork)))
@@ -34,6 +35,8 @@
(if (and (fboundp 'open-socket)
(fboundp 'fork))
- (each ((family (list af-inet af-inet6)))
- (unless (test)
- (error "test failed"))))
+ (let ((maybe-ipv6 (if (memqual (osname) '("GNU/Linux" "Darwin" "Cygwin"))
+ (list af-inet6))))
+ (each ((family ^(,af-inet ,*maybe-ipv6)))
+ (unless (dgram-test)
+ (error "test failed")))))
diff --git a/tests/common.tl b/tests/common.tl
index 301a5402..ea2be1d5 100644
--- a/tests/common.tl
+++ b/tests/common.tl
@@ -19,3 +19,7 @@
(defmacro stest (expr expected)
^(vtest ,^(tostring ,expr) ,expected))
+
+(defun osname ()
+ (with-stream (u (open-command "(uname -o || uname) 2> /dev/null"))
+ (get-line u)))