1.0.3.39: larger heap size for x86-64/darwin
[sbcl.git] / tests / run-program.test.sh
index 90e0187..b95931a 100644 (file)
@@ -8,16 +8,24 @@
 # While most of SBCL is derived from the CMU CL system, the test
 # files (like this one) were written from scratch after the fork
 # from CMU CL.
-# 
+#
 # This software is in the public domain and is provided with
 # absolutely no warranty. See the COPYING and CREDITS files for
 # more information.
 
 # Make sure that there's at least something in the environment (for
 # one of the tests below).
-export SOMETHING_IN_THE_ENVIRONMENT='yes there is'
+SOMETHING_IN_THE_ENVIRONMENT='yes there is'
+export SOMETHING_IN_THE_ENVIRONMENT
+PATH=/some/path/that/does/not/exist:${PATH}
+export PATH
 
-sbcl --noinform --noprint --sysinit /dev/null --userinit /dev/null <<EOF
+${SBCL:-sbcl} <<EOF
+  ;; test that $PATH is searched
+  (assert (zerop (sb-ext:process-exit-code
+                  (sb-ext:run-program "true" () :search t :wait t))))
+  (assert (not (zerop (sb-ext:process-exit-code
+                       (sb-ext:run-program "false" () :search t :wait t)))))
   (let ((string (with-output-to-string (stream)
                   (sb-ext:run-program "/bin/echo"
                                       '("foo" "bar")
@@ -28,8 +36,8 @@ sbcl --noinform --noprint --sysinit /dev/null --userinit /dev/null <<EOF
   ;; (instead of CMU CL alist-of-keywords convention).
   (let ((string (with-output-to-string (stream)
                   (sb-ext:run-program "/usr/bin/env" ()
-                                     :output stream
-                                     :environment '("FEEFIE=foefum")))))
+                                      :output stream
+                                      :environment '("FEEFIE=foefum")))))
     (assert (string= string "FEEFIE=foefum
 ")))
   ;; The default Unix environment for the subprocess is the same as
@@ -37,18 +45,25 @@ sbcl --noinform --noprint --sysinit /dev/null --userinit /dev/null <<EOF
   ;; other programs, but not like CMU CL.)
   (let ((string (with-output-to-string (stream)
                   (sb-ext:run-program "/usr/bin/env" ()
-                                     :output stream)))
-       (expected (apply #'concatenate
-                        'string
-                        (mapcar (lambda (environ-string)
-                                  (concatenate 'string
-                                               environ-string
-                                               (string #\newline)))
+                                      :output stream)))
+        (expected (apply #'concatenate
+                         'string
+                         (mapcar (lambda (environ-string)
+                                   (concatenate 'string
+                                                environ-string
+                                                (string #\newline)))
                                  (sb-ext:posix-environ)))))
     (assert (string= string expected)))
   ;; That's not just because POSIX-ENVIRON is having a bad hair
   ;; day and returning NIL, is it?
   (assert (plusp (length (sb-ext:posix-environ))))
+  ;; make sure that a stream input argument is basically reasonable.
+  (let ((string (let ((i (make-string-input-stream "abcdef")))
+                  (with-output-to-string (stream)
+                    (sb-ext:run-program "/bin/cat" ()
+                                        :input i :output stream)))))
+    (assert (= (length string) 6))
+    (assert (string= string "abcdef")))
   ;; success convention for this Lisp program run as part of a larger script
   (sb-ext:quit :unix-status 52)))
 EOF
@@ -57,16 +72,5 @@ if [ $? != 52 ]; then
     exit 1
 fi
 
-# known bugs:
-#
-#   sbcl-0.6.8:
-#
-#     (SB-EXT:RUN-PROGRAM "echo" NIL)
-#     => error in function SB-IMPL::%ENUMERATE-SEARCH-LIST:
-#        Undefined search list: path
-#
-#     (SB-EXT:RUN-PROGRAM "/bin/uname" '("-a") :OUTPUT :STREAM)
-#     doesn't return a STREAM (the way doc string claims)
-
 # success convention
 exit 104