Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asdf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
asdf
asdf
Commits
7c4776b1
Commit
7c4776b1
authored
Aug 22, 2016
by
Elias Pipping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: Cover terminate-process
parent
b1c4a6b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
2 deletions
+51
-2
test/test-run-program-unix-internal.script
test/test-run-program-unix-internal.script
+51
-2
No files found.
test/test-run-program-unix-internal.script
View file @
7c4776b1
...
...
@@ -198,6 +198,12 @@
(list :error-output :interactive)))))
(apply #'uiop/run-program::%run-program args)))
;; Skips the test if terminate-process cannot be called
(defun my-terminate-process (&rest rest)
#+ecl (unless (find-symbol* '#:terminate-process :ext nil)
(error 'test-skipped :reason "ext:terminate-process missing"))
(apply #'terminate-process rest))
;;; The actual tests
(new-test-suite "%run-program")
...
...
@@ -451,7 +457,7 @@
(handle-result "exit code matches? (no. 2)"
(equal (+ 128 15) (wait-process process-info)))))
(new-test-suite "process-alive-p")
(new-test-suite "process-alive-p
/ terminate-process
")
(define-test
"not alive (we slept)"
...
...
@@ -474,6 +480,30 @@
(not (process-alive-p
process-info)))))
(define-test
"not alive (we terminated it)"
(let ((process-info (%run-program "./sleeper.sh 12 2" :wait nil)))
(handle-result "alive?"
(process-alive-p process-info))
(my-terminate-process process-info :urgent t)
(sleep 1)
(handle-result "dead?"
(not (process-alive-p process-info)))
(wait-process process-info)))
(define-test
"not alive (we terminated it repeatedly)"
(let ((process-info (%run-program "./sleeper.sh 12 3" :wait nil)))
(handle-result "alive?"
(process-alive-p process-info))
(my-terminate-process process-info :urgent t)
(sleep 1)
(my-terminate-process process-info :urgent t)
(sleep 1)
(handle-result "dead?"
(not (process-alive-p process-info)))
(wait-process process-info)))
(define-test
"multiple processes: proper exit sequence"
(let ((process-info1 (%run-program "./sleeper.sh 12 1" :wait nil))
...
...
@@ -496,7 +526,7 @@
(not (process-alive-p
process-info2)))))
(new-test-suite "%process-status")
(new-test-suite "%process-status
/ terminate-process
")
(define-test
":exited (we slept; repeated query)"
...
...
@@ -550,6 +580,25 @@
(handle-result "proper exit status? (no. 2)?" (eql code (+ 128 15))))
(wait-process process-info)))
(define-test
":signaled (we terminated it; repeated query)"
#+(and lispworks (not lispworks7+))
(skip-test "Known to fail")
(let* ((process-info (%run-program "./sleeper.sh 12 2" :wait nil))
(status (uiop/run-program::%process-status process-info)))
(handle-result "running?" (equal :running status))
(my-terminate-process process-info :urgent t)
(sleep 1)
(multiple-value-bind (status code)
(uiop/run-program::%process-status process-info)
(handle-result "signaled?" (eq status :signaled))
(handle-result "signal as expected?" (member code '(9 15))))
(multiple-value-bind (status code)
(uiop/run-program::%process-status process-info)
(handle-result "signaled (no. 2)?" (eq status :signaled))
(handle-result "signal as expected (no. 2)?" (member code '(9 15))))
(wait-process process-info)))
(fresh-line)
(run-tests)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment