summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/ert.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-06-14 15:59:46 -0700
committerYuan Fu <casouri@gmail.com>2022-06-14 15:59:46 -0700
commit98bfb240818bae14cd87a1ffeb8fae7cb7846e05 (patch)
tree16e8ab06875ed54e110cf98ccdbd7e78f15905c6 /lisp/emacs-lisp/ert.el
parent184d212042ffa5a4f02c92085d9b6e8346d66e99 (diff)
parent787c4ad8b0776280305a220d6669c956d9ed8a5d (diff)
downloademacs-98bfb240818bae14cd87a1ffeb8fae7cb7846e05.tar.gz
emacs-98bfb240818bae14cd87a1ffeb8fae7cb7846e05.tar.bz2
emacs-98bfb240818bae14cd87a1ffeb8fae7cb7846e05.zip
Merge remote-tracking branch 'savannah/master' into feature/tree-sitter
Diffstat (limited to 'lisp/emacs-lisp/ert.el')
-rw-r--r--lisp/emacs-lisp/ert.el32
1 files changed, 21 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 00da5c718c7..82722add42a 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1538,18 +1538,28 @@ of the tests (e.g. invalid SELECTOR or bug in the code that runs
the tests)."
(or noninteractive
(user-error "This function is only for use in batch mode"))
- ;; Better crash loudly than attempting to recover from undefined
- ;; behavior.
- (setq attempt-stack-overflow-recovery nil
- attempt-orderly-shutdown-on-fatal-signal nil)
- (unwind-protect
- (let ((stats (ert-run-tests-batch selector)))
- (kill-emacs (if (zerop (ert-stats-completed-unexpected stats)) 0 1)))
+ (let ((eln-dir (and (featurep 'native-compile)
+ (make-temp-file "test-nativecomp-cache-" t))))
+ (when eln-dir
+ (startup-redirect-eln-cache eln-dir))
+ ;; Better crash loudly than attempting to recover from undefined
+ ;; behavior.
+ (setq attempt-stack-overflow-recovery nil
+ attempt-orderly-shutdown-on-fatal-signal nil)
(unwind-protect
- (progn
- (message "Error running tests")
- (backtrace))
- (kill-emacs 2))))
+ (let ((stats (ert-run-tests-batch selector)))
+ (when eln-dir
+ (ignore-errors
+ (delete-directory eln-dir t)))
+ (kill-emacs (if (zerop (ert-stats-completed-unexpected stats)) 0 1)))
+ (unwind-protect
+ (progn
+ (message "Error running tests")
+ (backtrace))
+ (when eln-dir
+ (ignore-errors
+ (delete-directory eln-dir t)))
+ (kill-emacs 2)))))
(defvar ert-load-file-name nil
"The name of the loaded ERT test file, a string.