109 lines
4.9 KiB
Diff
109 lines
4.9 KiB
Diff
|
From 35856b09e3606361b17f21225c759632be1cdf34 Mon Sep 17 00:00:00 2001
|
|||
|
From: Hraban Luyat <hraban@0brg.net>
|
|||
|
Date: Wed, 24 Jan 2024 14:58:53 -0500
|
|||
|
Subject: [PATCH] Search for binaries in tests in PATH, not /usr/bin
|
|||
|
MIME-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|||
|
Same as 8ed662fbfeb5dde35eb265f390b55b01f79f70c1 but for tests, and for more
|
|||
|
than just ‘cat’. For the same reasons as that diff.
|
|||
|
---
|
|||
|
tests/run-program.impure.lisp | 18 ++++++++++--------
|
|||
|
tests/run-program.test.sh | 9 ++++-----
|
|||
|
2 files changed, 14 insertions(+), 13 deletions(-)
|
|||
|
|
|||
|
diff --git a/tests/run-program.impure.lisp b/tests/run-program.impure.lisp
|
|||
|
index 0eab8884c..b07d1e4fb 100644
|
|||
|
--- a/tests/run-program.impure.lisp
|
|||
|
+++ b/tests/run-program.impure.lisp
|
|||
|
@@ -15,7 +15,7 @@
|
|||
|
|
|||
|
(defun bin-pwd-ignoring-result ()
|
|||
|
(let ((initially-open-fds (directory "/proc/self/fd/*" :resolve-symlinks nil)))
|
|||
|
- (sb-ext:run-program "/usr/bin/pwd" nil :input :stream :output :stream :wait nil)
|
|||
|
+ (sb-ext:run-program "pwd" nil :search t :input :stream :output :stream :wait nil)
|
|||
|
(length initially-open-fds)))
|
|||
|
|
|||
|
(with-test (:name (run-program :autoclose-streams)
|
|||
|
@@ -49,7 +49,7 @@
|
|||
|
(with-test (:name (run-program :cat 2)
|
|||
|
:skipped-on (or (not :sb-thread) :win32))
|
|||
|
;; Tests that reading from a FIFO is interruptible.
|
|||
|
- (let* ((process (run-program "/bin/cat" '()
|
|||
|
+ (let* ((process (run-program "cat" '() :search t
|
|||
|
:wait nil :output :stream :input :stream))
|
|||
|
(in (process-input process))
|
|||
|
(out (process-output process))
|
|||
|
@@ -167,7 +167,7 @@
|
|||
|
(defparameter *cat-out* (make-synonym-stream '*cat-out-pipe*)))
|
|||
|
|
|||
|
(with-test (:name (run-program :cat 5) :fails-on :win32)
|
|||
|
- (let ((cat (run-program "/bin/cat" nil :input *cat-in* :output *cat-out*
|
|||
|
+ (let ((cat (run-program "cat" nil :search t :input *cat-in* :output *cat-out*
|
|||
|
:wait nil)))
|
|||
|
(dolist (test '("This is a test!"
|
|||
|
"This is another test!"
|
|||
|
@@ -310,14 +310,16 @@
|
|||
|
(let ((had-error-p nil))
|
|||
|
(flet ((barf (&optional (format :default))
|
|||
|
(with-output-to-string (stream)
|
|||
|
- (run-program #-netbsd "/usr/bin/perl" #+netbsd "/usr/pkg/bin/perl"
|
|||
|
+ (run-program #-netbsd "perl" #+netbsd "/usr/pkg/bin/perl"
|
|||
|
'("-e" "print \"\\x20\\xfe\\xff\\x0a\"")
|
|||
|
+ :search #-netbsd t #+netbsd nil
|
|||
|
:output stream
|
|||
|
:external-format format)))
|
|||
|
(no-barf ()
|
|||
|
(with-output-to-string (stream)
|
|||
|
- (run-program "/bin/echo"
|
|||
|
+ (run-program "echo"
|
|||
|
'("This is a test")
|
|||
|
+ :search t
|
|||
|
:output stream))))
|
|||
|
(handler-case
|
|||
|
(barf :utf-8)
|
|||
|
@@ -353,9 +355,9 @@
|
|||
|
;; If the permitted inputs are :ANY then leave it be
|
|||
|
(listp (symbol-value 'run-tests::*allowed-inputs*)))
|
|||
|
(push (namestring file) (symbol-value 'run-tests::*allowed-inputs*)))
|
|||
|
- (assert (null (run-program "/bin/cat" '() :input file)))
|
|||
|
- (assert (null (run-program "/bin/cat" '() :output #.(or *compile-file-truename*
|
|||
|
- *load-truename*)
|
|||
|
+ (assert (null (run-program "cat" '() :search t :input file)))
|
|||
|
+ (assert (null (run-program "cat" '() :search t :output #.(or *compile-file-truename*
|
|||
|
+ *load-truename*)
|
|||
|
:if-output-exists nil)))))
|
|||
|
|
|||
|
|
|||
|
diff --git a/tests/run-program.test.sh b/tests/run-program.test.sh
|
|||
|
index 48eaef889..c926e5a05 100755
|
|||
|
--- a/tests/run-program.test.sh
|
|||
|
+++ b/tests/run-program.test.sh
|
|||
|
@@ -39,9 +39,8 @@ run_sbcl --eval "(defvar *exit-ok* $EXIT_LISP_WIN)" <<'EOF'
|
|||
|
(assert (not (zerop (sb-ext:process-exit-code
|
|||
|
(sb-ext:run-program "false" () :search t :wait t)))))
|
|||
|
(let ((string (with-output-to-string (stream)
|
|||
|
- (our-run-program "/bin/echo"
|
|||
|
- '("foo" "bar")
|
|||
|
- :output stream))))
|
|||
|
+ (run-program "echo" '("foo" "bar")
|
|||
|
+ :search t :output stream))))
|
|||
|
(assert (string= string "foo bar
|
|||
|
")))
|
|||
|
(format t ";;; Smoke tests: PASS~%")
|
|||
|
@@ -103,8 +102,8 @@ run_sbcl --eval "(defvar *exit-ok* $EXIT_LISP_WIN)" <<'EOF'
|
|||
|
;; make sure that a stream input argument is basically reasonable.
|
|||
|
(let ((string (let ((i (make-string-input-stream "abcdef")))
|
|||
|
(with-output-to-string (stream)
|
|||
|
- (our-run-program "/bin/cat" ()
|
|||
|
- :input i :output stream)))))
|
|||
|
+ (run-program "cat" ()
|
|||
|
+ :search t :input i :output stream)))))
|
|||
|
(assert (= (length string) 6))
|
|||
|
(assert (string= string "abcdef")))
|
|||
|
|
|||
|
--
|
|||
|
2.43.0
|
|||
|
|