From: Jim Porter Date: Sat, 15 Jun 2024 18:06:58 +0000 (-0700) Subject: ; Add command logging to some more Eshell tests X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=84903ad95e4de6e0be95e3a3c2448c7fca0b870b;p=emacs.git ; 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. (cherry picked from commit 7df855cdfe617614dbe23fb0302a647ee23589ea) --- diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index bb78f1786dd..68945cb5b0a 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el @@ -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