From bad77f4915af74db70b40cca2dddad9baa1fa86b Mon Sep 17 00:00:00 2001 From: Eric Timmons Date: Fri, 20 May 2022 14:11:10 -0400 Subject: [PATCH] Improve PROCESS-ENVIRON tests (ext:run-program "env" nil :environ '("foo=bar")) actually exits with non-zero status because 1) PATH is not specified in the child process and even if it were 2) the use of :ENVIRON prevents ECL from searching the PATH for child programs. Rewrite the tests to actually highlight the failure. --- src/tests/normal-tests/run-program.lsp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tests/normal-tests/run-program.lsp b/src/tests/normal-tests/run-program.lsp index 785fd031f..46c6ee576 100644 --- a/src/tests/normal-tests/run-program.lsp +++ b/src/tests/normal-tests/run-program.lsp @@ -176,9 +176,13 @@ #-windows (test process-environ - (is (read-line (ext:run-program "env" nil) nil nil)) - (is (read-line (ext:run-program "env" nil :environ '("foo=bar")) nil nil)) - (is (read-line (ext:run-program "env" nil :environ :default) nil nil)) + (is-equal 0 (nth-value 1 (ext:run-program "env" nil))) + (is-equal 0 (nth-value 1 (ext:run-program "env" nil :environ :default))) + (is-equal "bar" + (read-line (ext:run-program "printenv" '("foo") + :environ (list "foo=bar" + (format nil "PATH=~A" (ext:getenv "PATH")))) + nil nil)) (signals simple-error (ext:run-program "env" nil :environ :bam) nil nil) #-cygwin ;; Cygwin always injects `WINDIR=C:\\Windows' variable. (is (null (slurp (ext:run-program "/usr/bin/env" nil :environ nil)))))