]> git.eshelyaron.com Git - emacs.git/commitdiff
; Add command logging to some more Eshell tests
authorJim Porter <jporterbugs@gmail.com>
Sat, 15 Jun 2024 18:06:58 +0000 (11:06 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 17 Jun 2024 10:43:49 +0000 (12:43 +0200)
* 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)

test/lisp/eshell/esh-proc-tests.el

index bb78f1786ddf36cd7d11d215fdcda6b3bdf529b2..68945cb5b0adb8079001887e217c08419b1d593d 100644 (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))
+                       ""))))))
 
 \f
 ;; Remote processes