Eli Zaretskii <e...@gnu.org> skribis: >> From: l...@gnu.org (Ludovic Courtès) >> Cc: guile-devel <guile-devel@gnu.org> >> Date: Tue, 10 Jun 2014 13:44:17 +0200 >> >> Eli, I noticed there are many other occurrences of /dev/null in the test >> suite. Do they all need to be patched to use NUL, or is /dev/null >> somehow interpreted correctly in some contexts? > > When we send /dev/null to some Guile primitive, which calls open or > fopen internally, gnulib replaces that by nul, so it transparently > works. So only strings that are passed verbatim to the system shell > need to be fixed.
OK, thanks for the explanation. Below is the fix I just pushed. Ludo’. commit 82b8cfa40cbaea1ef2b8053af574c6d84f2705bc (HEAD, refs/heads/stable-2.0) Author: Ludovic Courtès <l...@gnu.org> Date: Wed Jun 11 14:35:26 2014 +0200 tests: Use NUL instead of /dev/null on MinGW. Reported by Eli Zaretskii <e...@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. Modified test-suite/test-suite/lib.scm diff --git a/test-suite/test-suite/lib.scm b/test-suite/test-suite/lib.scm index e25df78..5628ae0 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 ;;;; Modified test-suite/tests/c-api.test diff --git a/test-suite/tests/c-api.test b/test-suite/tests/c-api.test index 9a2108e..5ce033f 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 <djurfe...@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))) Modified test-suite/tests/popen.test diff --git a/test-suite/tests/popen.test b/test-suite/tests/popen.test index 2818be0..27e15dc 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))