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:
parent
ddbb110e87
commit
147912530c
1 changed files with 89 additions and 82 deletions
|
@ -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,15 +617,22 @@
|
||||||
|
|
||||||
;;;; 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)))
|
||||||
(close-pipe pipe)
|
(close-pipe pipe)
|
||||||
(pass-if "pipe: read"
|
(pass-if "pipe: read"
|
||||||
(equal? in-string "Howdy there, partner!\n")))
|
(equal? in-string "Howdy there, partner!\n")))
|
||||||
|
|
||||||
;;; Run a command, send some output to it, and see if it worked.
|
;;; 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")))
|
(pipe (open-pipe (string-append "grep Mommy > " filename) "w")))
|
||||||
(display "Now Jimmy lives on a mushroom cloud\n" pipe)
|
(display "Now Jimmy lives on a mushroom cloud\n" pipe)
|
||||||
(display "Mommy, why does everybody have a bomb?\n" pipe)
|
(display "Mommy, why does everybody have a bomb?\n" 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,7 +1026,8 @@
|
||||||
|
|
||||||
;;;; Generic operations across all port types.
|
;;;; 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.
|
;; Return a list of input ports that all return the same text.
|
||||||
;; We map tests over this list.
|
;; We map tests over this list.
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue