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) (define-module (test-suite test-ports)
#:use-module (test-suite lib) #:use-module (test-suite lib)
#:use-module (test-suite guile-test) #:use-module (test-suite guile-test)
#:use-module (ice-9 popen)
#:use-module (ice-9 rdelim) #:use-module (ice-9 rdelim)
#:use-module (ice-9 threads) #:use-module (ice-9 threads)
#:use-module (rnrs bytevectors) #:use-module (rnrs bytevectors)
@ -618,6 +617,13 @@
;;;; Pipe (popen) ports. ;;;; 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. ;;; 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))) (in-string (read-all pipe)))
@ -634,7 +640,7 @@
(let ((in-string (read-file filename))) (let ((in-string (read-file filename)))
(pass-if "pipe: write" (pass-if "pipe: write"
(equal? in-string "Mommy, why does everybody have a bomb?\n"))) (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" (pass-if-equal "pipe, fdopen, and line buffering"
"foo\nbar\n" "foo\nbar\n"
@ -1020,6 +1026,7 @@
;;;; Generic operations across all port types. ;;;; Generic operations across all port types.
(if-supported
(let ((port-loop-temp (test-file))) (let ((port-loop-temp (test-file)))
;; Return a list of input ports that all return the same text. ;; Return a list of input ports that all return the same text.
@ -1093,7 +1100,7 @@
" --- Thomas Jefferson\n" " --- Thomas Jefferson\n"
"no newline here") "no newline here")
"He who receives an idea from me, receives instruction" "He who receives an idea from me, receives instruction"
15))) 15))))
;; Test port-line and port-column for output ports ;; Test port-line and port-column for output ports