summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gran <spk121@yahoo.com>2017-04-04 07:33:41 -0700
committerMichael Gran <spk121@yahoo.com>2017-04-04 07:33:41 -0700
commit685ca33e2e21ee5fd8917d36772f60a85639fd9b (patch)
tree8ebc38d4b214604253c35f707533479ab66ce7eb
parent39339c9fb93e73483cb2dce0098aeb4fc3fc5643 (diff)
downloadguile-685ca33e2e21ee5fd8917d36772f60a85639fd9b.tar.gz
Only run tests that require fork if it is provided
* test-suite/tests/00-repl-server.test (call-with-repl-server): throw if no fork provided * test-suite/tests/00-socket.test (primitive-fork-if-available): new help procedure (bind/sockaddr, AF_UNIX/SOCK_STREAM): use helper func * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): throw if no fork provided
-rw-r--r--test-suite/tests/00-repl-server.test4
-rw-r--r--test-suite/tests/00-socket.test12
-rw-r--r--test-suite/tests/ports.test4
3 files changed, 13 insertions, 7 deletions
diff --git a/test-suite/tests/00-repl-server.test b/test-suite/tests/00-repl-server.test
index c4c38258e..54f518a66 100644
--- a/test-suite/tests/00-repl-server.test
+++ b/test-suite/tests/00-repl-server.test
@@ -32,8 +32,8 @@ socket connected to that server."
(false-if-exception
(delete-file (sockaddr:path sockaddr)))
- ;; The REPL server requires threads.
- (unless (provided? 'threads)
+ ;; The REPL server requires thread. The test requires fork.
+ (unless (and (provided? 'threads) (provided? 'fork))
(throw 'unsupported))
(match (primitive-fork)
diff --git a/test-suite/tests/00-socket.test b/test-suite/tests/00-socket.test
index 211aaaf20..7f55adea1 100644
--- a/test-suite/tests/00-socket.test
+++ b/test-suite/tests/00-socket.test
@@ -1,7 +1,7 @@
;;;; 00-socket.test --- test socket functions -*- scheme -*-
;;;;
;;;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-;;;; 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+;;;; 2011, 2012, 2013, 2014, 2017 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
@@ -161,6 +161,10 @@
(number->string (current-time)) "-"
(number->string (random 100000))))
+(define (primitive-fork-if-available)
+ (if (not (provided? 'fork))
+ -1
+ (primitive-fork)))
(if (defined? 'AF_UNIX)
(with-test-prefix "AF_UNIX/SOCK_DGRAM"
@@ -261,7 +265,7 @@
(force-output (current-output-port))
(force-output (current-error-port))
(if server-listening?
- (let ((pid (primitive-fork)))
+ (let ((pid (primitive-fork-if-available)))
;; Spawn a server process.
(case pid
((-1) (throw 'unresolved))
@@ -341,7 +345,7 @@
(force-output (current-output-port))
(force-output (current-error-port))
(if server-listening?
- (let ((pid (primitive-fork)))
+ (let ((pid (primitive-fork-if-available)))
;; Spawn a server process.
(case pid
((-1) (throw 'unresolved))
@@ -439,7 +443,7 @@
(force-output (current-output-port))
(force-output (current-error-port))
(if server-listening?
- (let ((pid (primitive-fork)))
+ (let ((pid (primitive-fork-if-available)))
;; Spawn a server process.
(case pid
((-1) (throw 'unresolved))
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index 207c0cfa7..007f56605 100644
--- a/test-suite/tests/ports.test
+++ b/test-suite/tests/ports.test
@@ -2,7 +2,7 @@
;;;; Jim Blandy <jimb@red-bean.com> --- May 1999
;;;;
;;;; Copyright (C) 1999, 2001, 2004, 2006, 2007, 2009, 2010,
-;;;; 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
+;;;; 2011, 2012, 2013, 2014, 2015, 2017 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
@@ -638,6 +638,8 @@
(pass-if-equal "pipe, fdopen, and line buffering"
"foo\nbar\n"
+ (unless (provided? 'fork)
+ (throw 'unresolved))
(let ((in+out (pipe))
(pid (primitive-fork)))
(if (zero? pid)