From a6551d3c4b832ef4b724e6039c615dfd56d76b7e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 10 Mar 2016 06:49:57 -0800 Subject: Run IPv6 tests only on some operating systems. * tests/014/dgram-stream.tl (test): Renamed to dgram-test since now this includes common.tl which has a macro called test. Only include af-inet6 in the family list if the OS is GNU/Linux, Darwin or Cygwin. * tests/common.tl (osname): New function. --- tests/014/dgram-stream.tl | 11 +++++++---- tests/common.tl | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'tests') 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))) -- cgit v1.2.3