Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
12018284
by Raymond Toy at 2017-09-30T13:51:23-07:00
-
3665075a
by Raymond Toy at 2017-09-30T14:18:55-07:00
-
00689a63
by Raymond Toy at 2017-09-30T14:20:44-07:00
-
d2efe772
by Raymond Toy at 2017-09-30T14:21:03-07:00
-
ba357de8
by Raymond Toy at 2017-09-30T21:31:16+00:00
6 changed files:
- .gitignore
- bin/run-tests.sh
- src/code/run-program.lisp
- src/i18n/locale/cmucl.pot
- src/lisp/runprog.c
- tests/issues.lisp
Changes:
| 1 |
-# Ignore default build directories
|
|
| 2 |
-darwin-[234]
|
|
| 3 |
-darwin-8bit-[234]
|
|
| 4 |
-linux-[234]
|
|
| 5 |
-linux-8bit-[234]
|
|
| 6 |
-sparc-[234]
|
|
| 7 |
-sparc-8bit-[234]
|
|
| 8 |
-build-*
|
|
| 9 | 1 |
|
| 10 |
-# Ignore emacs files
|
|
| 11 |
-*~
|
|
| 12 | 2 |
|
| 3 |
+ |
|
| 4 |
+# Ignore default build directories
|
|
| 5 |
+# Ignore emacs files
|
|
| 13 | 6 |
# Ignore fasls
|
| 7 |
+# Ignore files generated by TeX
|
|
| 14 | 8 |
*.fasl
|
| 15 |
-*.sse2f
|
|
| 16 |
-*.x86f
|
|
| 17 | 9 |
*.ppcf
|
| 18 | 10 |
*.sparcf
|
| 19 |
- |
|
| 20 |
-# Ignore files generated by TeX
|
|
| 11 |
+*.sse2f
|
|
| 12 |
+*.x86f
|
|
| 13 |
+*~
|
|
| 14 |
+/test-tmp
|
|
| 15 |
+build-*
|
|
| 16 |
+darwin-8bit-[234]
|
|
| 17 |
+darwin-[234]
|
|
| 18 |
+linux-8bit-[234]
|
|
| 19 |
+linux-[234]
|
|
| 20 |
+sparc-8bit-[234]
|
|
| 21 |
+sparc-[234]
|
|
| 21 | 22 |
src/docs/cmu-user/*.aux
|
| 22 | 23 |
src/docs/cmu-user/*.cdx
|
| 23 | 24 |
src/docs/cmu-user/*.cnd
|
| 24 | 25 |
src/docs/cmu-user/*.fdx
|
| 25 | 26 |
src/docs/cmu-user/*.fnd
|
| 26 | 27 |
src/docs/cmu-user/*.idx
|
| 28 |
+src/docs/cmu-user/*.ilg
|
|
| 29 |
+src/docs/cmu-user/*.log
|
|
| 30 |
+src/docs/cmu-user/*.out
|
|
| 31 |
+src/docs/cmu-user/*.pdf
|
|
| 27 | 32 |
src/docs/cmu-user/*.tdx
|
| 28 | 33 |
src/docs/cmu-user/*.tnd
|
| 29 | 34 |
src/docs/cmu-user/*.toc
|
| 30 | 35 |
src/docs/cmu-user/*.vdx
|
| 31 | 36 |
src/docs/cmu-user/*.vnd
|
| 32 |
-src/docs/cmu-user/*.ilg
|
|
| 33 |
-src/docs/cmu-user/*.out
|
|
| 34 |
-src/docs/cmu-user/*.pdf
|
|
| 35 |
-src/docs/cmu-user/*.log
|
| ... | ... | @@ -34,6 +34,12 @@ done |
| 34 | 34 |
# Shift out the options
|
| 35 | 35 |
shift $[$OPTIND - 1]
|
| 36 | 36 |
|
| 37 |
+# Create the test directory needed issue.45 test.
|
|
| 38 |
+ |
|
| 39 |
+rm -rf test-tmp
|
|
| 40 |
+mkdir test-tmp
|
|
| 41 |
+ln -s /bin/ls test-tmp/ls-link
|
|
| 42 |
+ |
|
| 37 | 43 |
if [ $# -eq 0 ]; then
|
| 38 | 44 |
# No args so run all the tests
|
| 39 | 45 |
$LISP -noinit -load tests/run-tests.lisp -eval '(cmucl-test-runner:run-all-tests)'
|
| ... | ... | @@ -528,10 +528,7 @@ |
| 528 | 528 |
;; info. Also, establish proc at this level so we can return it.
|
| 529 | 529 |
(let (*close-on-error* *close-in-parent* *handlers-installed* proc)
|
| 530 | 530 |
(unwind-protect
|
| 531 |
- (let ((pfile (unix-namestring (merge-pathnames program "path:") t t))
|
|
| 532 |
- (cookie (list 0)))
|
|
| 533 |
- (unless pfile
|
|
| 534 |
- (error (intl:gettext "No such program: ~S") program))
|
|
| 531 |
+ (let ((cookie (list 0)))
|
|
| 535 | 532 |
(multiple-value-bind
|
| 536 | 533 |
(stdin input-stream)
|
| 537 | 534 |
(get-descriptor-for input cookie :direction :input
|
| ... | ... | @@ -570,7 +567,7 @@ |
| 570 | 567 |
env))
|
| 571 | 568 |
(let ((child-pid
|
| 572 | 569 |
(without-gcing
|
| 573 |
- (spawn pfile argv envp pty-name
|
|
| 570 |
+ (spawn program argv envp pty-name
|
|
| 574 | 571 |
stdin stdout stderr))))
|
| 575 | 572 |
(when (< child-pid 0)
|
| 576 | 573 |
(error (intl:gettext "Could not fork child process: ~A")
|
| ... | ... | @@ -13251,10 +13251,6 @@ msgid "All args to program must be simple strings -- ~S." |
| 13251 | 13251 |
msgstr ""
|
| 13252 | 13252 |
|
| 13253 | 13253 |
#: src/code/run-program.lisp
|
| 13254 |
-msgid "No such program: ~S"
|
|
| 13255 |
-msgstr ""
|
|
| 13256 |
- |
|
| 13257 |
-#: src/code/run-program.lisp
|
|
| 13258 | 13254 |
msgid "Could not fork child process: ~A"
|
| 13259 | 13255 |
msgstr ""
|
| 13260 | 13256 |
|
| ... | ... | @@ -65,10 +65,10 @@ spawn(char *program, char *argv[], char *envp[], char *pty_name, |
| 65 | 65 |
/* Exec the program. */
|
| 66 | 66 |
execve(program, argv, envp);
|
| 67 | 67 |
|
| 68 |
- /* It didn't work, so try /bin/sh. */
|
|
| 68 |
+ /* It didn't work, so try /usr/bin/env. */
|
|
| 69 | 69 |
argv[0] = program;
|
| 70 |
- argv[-1] = "sh";
|
|
| 71 |
- execve("/bin/sh", argv - 1, envp);
|
|
| 70 |
+ argv[-1] = "/usr/bin/env";
|
|
| 71 |
+ execve("/usr/bin/env", argv - 1, envp);
|
|
| 72 | 72 |
|
| 73 | 73 |
/* The exec didn't work, flame out. */
|
| 74 | 74 |
exit(1);
|
| ... | ... | @@ -405,3 +405,33 @@ |
| 405 | 405 |
(define-test issue.41.2
|
| 406 | 406 |
(:tag :issues)
|
| 407 | 407 |
(issue-41-tester unix:sigtstp))
|
| 408 |
+ |
|
| 409 |
+(define-test issue.45
|
|
| 410 |
+ (:tag :issues)
|
|
| 411 |
+ ;; This depends on run-tests to setup the test directory correctly!
|
|
| 412 |
+ (let* ((test-dir #p"test-tmp/")
|
|
| 413 |
+ (test-dir-name (namestring test-dir)))
|
|
| 414 |
+ (flet ((do-test (program)
|
|
| 415 |
+ (with-output-to-string (s)
|
|
| 416 |
+ (let ((process
|
|
| 417 |
+ (ext:run-program program
|
|
| 418 |
+ (list test-dir-name)
|
|
| 419 |
+ :wait t :output s)))
|
|
| 420 |
+ ;; Verify process exited without error and that we
|
|
| 421 |
+ ;; got the expected output.
|
|
| 422 |
+ (assert-eql 0
|
|
| 423 |
+ (ext:process-exit-code process))
|
|
| 424 |
+ (assert-equal "ls-link
|
|
| 425 |
+"
|
|
| 426 |
+ (get-output-stream-string s))))))
|
|
| 427 |
+ ;; Test that absolute paths work.
|
|
| 428 |
+ (do-test "/bin/ls")
|
|
| 429 |
+ ;; Test that unspecfied path works. This depends on "ls" being
|
|
| 430 |
+ ;; somewhere in PATH.
|
|
| 431 |
+ (do-test "ls")
|
|
| 432 |
+ ;; Test that relative path to program works. (Issue #45).
|
|
| 433 |
+ (do-test (concatenate 'string
|
|
| 434 |
+ "./"
|
|
| 435 |
+ test-dir-name
|
|
| 436 |
+ "ls-link")))))
|
|
| 437 |
+
|