Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asdf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tarn Burton
asdf
Commits
077a87fe
Commit
077a87fe
authored
9 years ago
by
Francois-Rene Rideau
Browse files
Options
Downloads
Patches
Plain Diff
test-run-program: more debugging
parent
31e21864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test-run-program.script
+10
-9
10 additions, 9 deletions
test/test-run-program.script
with
10 additions
and
9 deletions
test/test-run-program.script
+
10
−
9
View file @
077a87fe
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
#-(and sbcl os-windows)
#-(and sbcl os-windows)
(let ((ok1 (format nil "; $ echo ok 1~%ok 1")))
(let ((ok1 (format nil "; $ echo ok 1~%ok 1")))
(untrace)
(DBG "Testing awkward legacy output capture via run-shell-command")
(DBG "Testing awkward legacy output capture via run-shell-command")
(assert-equal
(assert-equal
(dewindowize
(dewindowize
...
@@ -166,29 +167,27 @@ Testing run-program
...
@@ -166,29 +167,27 @@ Testing run-program
t)
t)
(defun common-test/run-program ()
(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 '("abcde") (run-program '("echo" "abcde") :output :lines))
(assert-equal (nl "fghij") (run-program '("echo" "fghij") :output :string))
(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 '("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))
(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)
#+(or clozure (and allegro os-unix) cmu (and lispworks os-unix) sbcl scl)
(signals error (run-program '("") :output :lines))
(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))
(assert-equal "" (run-program "" :output :string))
;; Test that run-program fails properly with a
(DBG "Test that run-program fails properly with a nil program list")
;; nil program list
#+(or clozure (and allegro os-unix) cmu sbcl scl)
#+(or clozure (and allegro os-unix) cmu sbcl scl)
(signals error (run-program nil :output :lines))
(signals error (run-program nil :output :lines))
;; Test that run-program fails properly when the
(DBG "Test that run-program fails properly when the executable doesn't exist.")
;; executable doesn't exist.
(signals error (run-program '("does-not-exist") :output :lines))
(signals error (run-program '("does-not-exist") :output :lines))
(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
...
@@ -199,14 +198,17 @@ Testing run-program
(defun unix-only-test/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 :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)))
(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")))
(assert-equal '(nil nil 0) (multiple-value-list (run-program "true")))
(signals subprocess-error (run-program "false"))
(signals subprocess-error (run-program "false"))
(assert-equal '(nil nil 1) (multiple-value-list (run-program "false" :ignore-error-status t)))
(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"))))
(let ((tf (native-namestring (test-source "test-file"))))
;; a basic smoke test
;; a basic smoke test
...
@@ -254,5 +256,4 @@ Testing run-program
...
@@ -254,5 +256,4 @@ Testing run-program
(terpri)
(terpri)
t)
t)
(test/run-program)
(test/run-program)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment