Skip to content
Snippets Groups Projects
Commit 077a87fe authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

test-run-program: more debugging

parent 31e21864
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,7 @@
#-(and sbcl os-windows)
(let ((ok1 (format nil "; $ echo ok 1~%ok 1")))
(untrace)
(DBG "Testing awkward legacy output capture via run-shell-command")
(assert-equal
(dewindowize
......@@ -166,29 +167,27 @@ Testing run-program
t)
(defun common-test/run-program ()
;; Can we echo a simple string?
(DBG "Can we echo a simple string?")
(assert-equal '("abcde") (run-program '("echo" "abcde") :output :lines))
(assert-equal (nl "fghij") (run-program '("echo" "fghij") :output :string))
;; Are spaces handled properly?
(DBG "Are spaces handled properly?")
(assert-equal '("Hello World") (run-program '("echo" "Hello World") :output :lines))
(assert-equal (nl "Hello World") (run-program '("echo" "Hello World") :output :string))
(assert-equal (nl "Hello World") (run-program "echo Hello World" :output :string))
;; Test that run-program fails properly with an empty program string
(DBG "Test that run-program fails properly with an empty program string")
#+(or clozure (and allegro os-unix) cmu (and lispworks os-unix) sbcl scl)
(signals error (run-program '("") :output :lines))
;; An empty string itself is ok since it is passed to the shell.
(DBG "An empty string itself is ok since it is passed to the shell.")
(assert-equal "" (run-program "" :output :string))
;; Test that run-program fails properly with a
;; nil program list
(DBG "Test that run-program fails properly with a nil program list")
#+(or clozure (and allegro os-unix) cmu sbcl scl)
(signals error (run-program nil :output :lines))
;; Test that run-program fails properly when the
;; executable doesn't exist.
(DBG "Test that run-program fails properly when the executable doesn't exist.")
(signals error (run-program '("does-not-exist") :output :lines))
(signals error (run-program "does-not-exist" :output :lines))
......@@ -199,14 +198,17 @@ Testing run-program
(defun unix-only-test/run-program ()
(DBG "Checking that spaces between arguments are collapsed by shell when and only when unquoted")
(assert-equal '("ok 1") (run-program "echo ok 1" :output :lines))
(assert-equal '("ok 1") (run-program '("echo" "ok 1") :output :lines))
(assert-equal "ok 1" (run-program '("echo" "ok 1") :output '(:string :stripped t)))
(DBG "Checking behavior on program success or failure")
(assert-equal '(nil nil 0) (multiple-value-list (run-program "true")))
(signals subprocess-error (run-program "false"))
(assert-equal '(nil nil 1) (multiple-value-list (run-program "false" :ignore-error-status t)))
(DBG "Tests with test-file")
(let ((tf (native-namestring (test-source "test-file"))))
;; a basic smoke test
......@@ -254,5 +256,4 @@ Testing run-program
(terpri)
t)
(test/run-program)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment