# absolutely no warranty. See the COPYING and CREDITS files for
# more information.
+. ./subr.sh
+
# Make sure that there's at least something in the environment (for
# one of the tests below).
SOMETHING_IN_THE_ENVIRONMENT='yes there is'
PATH=/some/path/that/does/not/exist:${PATH}
export PATH
-${SBCL:-sbcl} <<'EOF'
+# This should probably be broken up into separate pieces.
+run_sbcl --eval "(defvar *exit-ok* $EXIT_LISP_WIN)" <<'EOF'
;; test that $PATH is searched
(assert (zerop (sb-ext:process-exit-code
(sb-ext:run-program "true" () :search t :wait t))))
:input i :output stream)))))
(assert (= (length string) 6))
(assert (string= string "abcdef")))
+
+ ;;; Test the bookkeeping involved in decoding the child's output:
+
+ ;; repeated short, properly-encoded reads exposed one bug. (But
+ ;; note: this test will be inconclusive if the child's stderr is
+ ;; fully buffered.)
+ (let ((str (with-output-to-string (s)
+ (run-program "/bin/sh"
+ '("-c" "(echo Foo; sleep 2; echo Bar)>&2")
+ :output s :search t :error :output :wait t))))
+ (assert (string= str (format nil "Foo~%Bar~%"))))
+
+ ;; end of file in the middle of a UTF-8 character
+ (typep (nth-value 1 (ignore-errors
+ (let ((sb-impl::*default-external-format* :utf-8))
+ (with-output-to-string (s)
+ (run-program "printf" '("\\316")
+ :output s :search t :wait t)))))
+ 'error)
+
;; success convention for this Lisp program run as part of a larger script
- (sb-ext:quit :unix-status 52)))
+ (sb-ext:quit :unix-status *exit-ok*)))
EOF
-if [ $? != 52 ]; then
- echo test failed: $?
- exit 1
-fi
+check_status_maybe_lose "run program tests" $?
-# success convention
-exit 104
+exit $EXIT_TEST_WIN