1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

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.
This commit is contained in:
Ludovic Courtès 2014-06-11 14:35:26 +02:00
parent 43191a31a5
commit 82b8cfa40c
3 changed files with 19 additions and 5 deletions

View file

@ -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
;;;;

View file

@ -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)))

View file

@ -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))