1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Skip ports tests that require popen if popen not available

* test-suite/tests/ports.test (define-module): don't use (ice-9 popen)
  (if-supported): new syntax
  (pipe:write, pipe:write): disable if no popen provided
  (line-counter): disable if no popen provided
This commit is contained in:
Michael Gran 2017-04-04 09:14:53 -07:00
parent ddbb110e87
commit 147912530c

View file

@ -21,7 +21,6 @@
(define-module (test-suite test-ports)
#:use-module (test-suite lib)
#:use-module (test-suite guile-test)
#:use-module (ice-9 popen)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 threads)
#:use-module (rnrs bytevectors)
@ -618,15 +617,22 @@
;;;; Pipe (popen) ports.
(define-syntax-rule (if-supported body ...)
(when (provided? 'popen)
(begin body ...)))
(if-supported
(use-modules (ice-9 popen))
;;; Run a command, and read its output.
(let* ((pipe (open-pipe "echo 'Howdy there, partner!'" "r"))
(let* ((pipe (open-pipe "echo 'Howdy there, partner!'" "r"))
(in-string (read-all pipe)))
(close-pipe pipe)
(pass-if "pipe: read"
(equal? in-string "Howdy there, partner!\n")))
;;; Run a command, send some output to it, and see if it worked.
(let* ((filename (test-file))
(let* ((filename (test-file))
(pipe (open-pipe (string-append "grep Mommy > " filename) "w")))
(display "Now Jimmy lives on a mushroom cloud\n" pipe)
(display "Mommy, why does everybody have a bomb?\n" pipe)
@ -634,7 +640,7 @@
(let ((in-string (read-file filename)))
(pass-if "pipe: write"
(equal? in-string "Mommy, why does everybody have a bomb?\n")))
(delete-file filename))
(delete-file filename)))
(pass-if-equal "pipe, fdopen, and line buffering"
"foo\nbar\n"
@ -1020,7 +1026,8 @@
;;;; Generic operations across all port types.
(let ((port-loop-temp (test-file)))
(if-supported
(let ((port-loop-temp (test-file)))
;; Return a list of input ports that all return the same text.
;; We map tests over this list.
@ -1093,7 +1100,7 @@
" --- Thomas Jefferson\n"
"no newline here")
"He who receives an idea from me, receives instruction"
15)))
15))))
;; Test port-line and port-column for output ports