emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/igc 2df3af1c885 5/5: (Bug#71988) Avoid excessively large backtra


From: Pip Cet
Subject: scratch/igc 2df3af1c885 5/5: (Bug#71988) Avoid excessively large backtraces in ert-tests
Date: Tue, 9 Jul 2024 02:13:11 -0400 (EDT)

branch: scratch/igc
commit 2df3af1c88531ae7fa04de9a1f83b70c4c2b505b
Author: Pip Cet <pipcet@protonmail.com>
Commit: Pip Cet <pipcet@protonmail.com>

    (Bug#71988) Avoid excessively large backtraces in ert-tests
    
    * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch-expensive):
    Temporarily make `cl-print-object' not print out vectors while running
    the test.
---
 test/lisp/emacs-lisp/ert-tests.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/lisp/emacs-lisp/ert-tests.el 
b/test/lisp/emacs-lisp/ert-tests.el
index 1aff73d66f6..b236dd43877 100644
--- a/test/lisp/emacs-lisp/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
@@ -594,9 +594,13 @@ This macro is used to test if macroexpansion in `should' 
works."
                         :body (lambda () (should (equal complex-list 1))))))
     (let ((ert-debug-on-error nil)
           messages)
-      (cl-letf* (((symbol-function 'message)
+      (cl-letf* (((symbol-function 'cl-print-object) (symbol-function 
'cl-print-object))
+                 ((symbol-function 'message)
                   (lambda (format-string &rest args)
                     (push (apply #'format format-string args) messages))))
+        ;; don't print the ert--stats-tests vector, which would run out of
+        ;; memory if previous tests have failed.
+        (cl-defmethod cl-print-object ((_object vector) _stream))
         (save-window-excursion
           (let ((case-fold-search nil)
                 (ert-batch-backtrace-right-margin nil)
@@ -611,7 +615,9 @@ This macro is used to test if macroexpansion in `should' 
works."
                 do
                 (unless found-frame
                   (setq found-frame (cl-search frame msg :test 'equal))))
-        (should found-frame)))))
+        (should found-frame))))
+  ;; ensure our temporary binding was undone.
+  (should (equal (cl-prin1-to-string [a]) "[a]")))
 
 (ert-deftest ert-test-special-operator-p ()
   (should (ert--special-operator-p 'if))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]