summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-11 14:35:26 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-11 14:36:55 +0200
commit82b8cfa40cbaea1ef2b8053af574c6d84f2705bc (patch)
tree298f029c5b037aef6c4162d2e87cb4b85db8cf35
parent43191a31a5f15729acbde3fa58f750021977a9f9 (diff)
downloadguile-82b8cfa40cbaea1ef2b8053af574c6d84f2705bc.tar.gz
tests: Use NUL instead of /dev/null on MinGW.
Reported by Eli Zaretskii <eliz@gnu.org>. * test-suite/test-suite/lib.scm (%null-device): New variable. * test-suite/tests/c-api.test (egrep): Use %NULL-DEVICE instead of /dev/null. * test-suite/tests/popen.test ("open-input-pipe")["no duplicate"]: Likewise.
-rw-r--r--test-suite/test-suite/lib.scm13
-rw-r--r--test-suite/tests/c-api.test5
-rw-r--r--test-suite/tests/popen.test6
3 files changed, 19 insertions, 5 deletions
diff --git a/test-suite/test-suite/lib.scm b/test-suite/test-suite/lib.scm
index e25df7891..5628ae02a 100644
--- a/test-suite/test-suite/lib.scm
+++ b/test-suite/test-suite/lib.scm
@@ -1,6 +1,6 @@
;;;; test-suite/lib.scm --- generic support for testing
;;;; Copyright (C) 1999, 2000, 2001, 2004, 2006, 2007, 2009, 2010,
-;;;; 2011, 2012, 2013 Free Software Foundation, Inc.
+;;;; 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -63,6 +63,9 @@
;; Using a given locale
with-locale with-locale* with-latin1-locale with-latin1-locale*
+ ;; The bit bucket.
+ %null-device
+
;; Reporting results in various ways.
register-reporter unregister-reporter reporter-registered?
make-count-reporter print-counts
@@ -571,6 +574,14 @@
((_ body ...)
(with-latin1-locale* (lambda () body ...)))))
+(define %null-device
+ ;; On Windows (MinGW), /dev/null does not exist and we must instead
+ ;; use NUL. Note that file system procedures automatically translate
+ ;; /dev/null, so this variable is only useful for shell snippets.
+ (if (file-exists? "/dev/null")
+ "/dev/null"
+ "NUL"))
+
;;;; REPORTERS
;;;;
diff --git a/test-suite/tests/c-api.test b/test-suite/tests/c-api.test
index 9a2108e69..5ce033f8d 100644
--- a/test-suite/tests/c-api.test
+++ b/test-suite/tests/c-api.test
@@ -1,7 +1,7 @@
;;;; c-api.test --- complementary test suite for the c-api -*- scheme -*-
;;;; MDJ 990915 <djurfeldt@nada.kth.se>
;;;;
-;;;; Copyright (C) 1999, 2006, 2012 Free Software Foundation, Inc.
+;;;; Copyright (C) 1999, 2006, 2012, 2014 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
@@ -22,7 +22,8 @@
(define srcdir (cdr (assq 'srcdir %guile-build-info)))
(define (egrep string filename)
- (zero? (system (string-append "egrep '" string "' " filename " >/dev/null"))))
+ (zero? (system (string-append "egrep '" string "' " filename
+ " >" %null-device))))
(define (seek-offset-test dirname)
(let ((dir (opendir dirname)))
diff --git a/test-suite/tests/popen.test b/test-suite/tests/popen.test
index 2818be01b..27e15dcad 100644
--- a/test-suite/tests/popen.test
+++ b/test-suite/tests/popen.test
@@ -1,6 +1,6 @@
;;;; popen.test --- exercise ice-9/popen.scm -*- scheme -*-
;;;;
-;;;; Copyright 2003, 2006, 2010, 2011, 2013 Free Software Foundation, Inc.
+;;;; Copyright 2003, 2006, 2010, 2011, 2013, 2014 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
@@ -109,7 +109,9 @@
(with-input-from-port (car p2c)
(lambda ()
(open-input-pipe
- "exec 1>/dev/null; echo closed 1>&2; exec 2>/dev/null; read REPLY")))))))
+ (format #f "exec 1>~a; echo closed 1>&2; \
+exec 2>~a; read REPLY"
+ %null-device %null-device))))))))
(close-port (cdr c2p)) ;; write side
(let ((result (eof-object? (read-char port))))
(display "hello!\n" (cdr p2c))