summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gran <spk121@yahoo.com>2023-06-02 18:57:06 -0700
committerMichael Gran <spk121@yahoo.com>2025-03-22 06:27:51 -0700
commit73a8ca88fba38beb2ddeeca3317696d5a7eb706c (patch)
treeb0d77a61d6293c8a62849442c380f34671d0c8d8
parentb572f187afaa2dddc6d0a70b16461a2f506a9511 (diff)
downloadguile-73a8ca88fba38beb2ddeeca3317696d5a7eb706c.tar.gz
ports.test: catch pipe errors
Refactors a couple of the ports tests to catch errors in the test runner, so that the test suite will print ERROR on failure. * test-suite/tests/ports.test (pipe:write, pipe:read): modified
-rw-r--r--test-suite/tests/ports.test31
1 files changed, 16 insertions, 15 deletions
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index bec5e356c..82881aa28 100644
--- a/test-suite/tests/ports.test
+++ b/test-suite/tests/ports.test
@@ -2,7 +2,7 @@
;;;; Jim Blandy <jimb@red-bean.com> --- May 1999
;;;;
;;;; Copyright (C) 1999, 2001, 2004, 2006-2007, 2009-2015, 2017, 2019-2021,
-;;;; 2024 Free Software Foundation, Inc.
+;;;; 2024,2025 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
@@ -736,22 +736,23 @@
;;;; Pipe (popen) ports.
;;; Run a command, and read its output.
-(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")))
+(pass-if "pipe: read"
+ (let* ((pipe (open-pipe "echo 'Howdy there, partner!'" "r"))
+ (in-string (read-all pipe)))
+ (close-pipe pipe)
+ (equal? in-string "Howdy there, partner!\n")))
+
;;; Run a command, send some output to it, and see if it worked.
-(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)
- (close-pipe pipe)
- (let ((in-string (read-file filename)))
- (pass-if "pipe: write"
- (equal? in-string "Mommy, why does everybody have a bomb?\n")))
- (delete-file filename))
+(pass-if "pipe: write"
+ (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)
+ (close-pipe pipe)
+ (let ((in-string (read-file filename)))
+ (delete-file filename)
+ (equal? in-string "Mommy, why does everybody have a bomb?\n"))))
(pass-if-equal "pipe, fdopen, and line buffering"
"foo\nbar\n"