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.
This commit is contained in:
Eric Timmons 2022-05-20 14:11:10 -04:00
parent 4e9fab94eb
commit bad77f4915
No known key found for this signature in database
GPG key ID: 46EE18103735D756

View file

@ -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)))))