1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

; Add command logging to some more Eshell tests

* test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline)
(esh-proc-test/kill-pipeline-head): Write debug logs on failure.
This commit is contained in:
Jim Porter 2024-06-15 11:06:58 -07:00
parent 1bc093e33c
commit 7df855cdfe

View File

@ -290,17 +290,18 @@ prompt. See bug#54136."
;; fine elsewhere.
(skip-when (getenv "EMACS_EMBA_CI"))
(with-temp-eshell
(eshell-insert-command
(concat "sh -c 'while true; do echo y; sleep 1; done' | "
"sh -c 'while true; do read NAME; done'"))
(let ((output-start (eshell-beginning-of-output)))
(eshell-kill-process)
(eshell-wait-for-subprocess t)
(should (string-match-p
;; "interrupt\n" is for MS-Windows.
(rx (or "interrupt\n" "killed\n" "killed: 9\n" ""))
(buffer-substring-no-properties
output-start (eshell-end-of-output)))))))
(ert-info (#'eshell-get-debug-logs :prefix "Command logs: ")
(eshell-insert-command
(concat "sh -c 'while true; do echo y; sleep 1; done' | "
"sh -c 'while true; do read NAME; done'"))
(let ((output-start (eshell-beginning-of-output)))
(eshell-kill-process)
(eshell-wait-for-subprocess t)
(should (string-match-p
;; "interrupt" is for MS-Windows.
(rx bos (or "interrupt" "killed" "killed: 9" "") eol)
(buffer-substring-no-properties
output-start (eshell-end-of-output))))))))
(ert-deftest esh-proc-test/kill-pipeline-head ()
"Test that killing the first process in a pipeline doesn't
@ -309,15 +310,16 @@ write the exit status to the pipe. See bug#54136."
(executable-find "echo")
(executable-find "sleep")))
(with-temp-eshell
(eshell-insert-command
(concat "sh -c 'while true; do sleep 1; done' | "
"sh -c 'while read NAME; do echo =${NAME}=; done'"))
(let ((output-start (eshell-beginning-of-output)))
(kill-process (eshell-head-process))
(eshell-wait-for-subprocess t)
(should (equal (buffer-substring-no-properties
output-start (eshell-end-of-output))
"")))))
(ert-info (#'eshell-get-debug-logs :prefix "Command logs: ")
(eshell-insert-command
(concat "sh -c 'while true; do sleep 1; done' | "
"sh -c 'while read NAME; do echo =${NAME}=; done'"))
(let ((output-start (eshell-beginning-of-output)))
(kill-process (eshell-head-process))
(eshell-wait-for-subprocess t)
(should (equal (buffer-substring-no-properties
output-start (eshell-end-of-output))
""))))))
;; Remote processes