Function: ert-run-tests-batch-and-exit

ert-run-tests-batch-and-exit is an autoloaded and byte-compiled function defined in ert.el.gz.

Signature

(ert-run-tests-batch-and-exit &optional SELECTOR)

Documentation

Like ert-run-tests-batch, but exits Emacs when done.

The exit status will be 0 if all test results were as expected, 1 on unexpected results, or 2 if the tool detected an error outside of the tests (e.g. invalid SELECTOR or bug in the code that runs the tests).

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
;;;###autoload
(defun ert-run-tests-batch-and-exit (&optional selector)
  "Like `ert-run-tests-batch', but exits Emacs when done.

The exit status will be 0 if all test results were as expected, 1
on unexpected results, or 2 if the tool detected an error outside
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)))
    (unwind-protect
        (progn
          (message "Error running tests")
          (backtrace))
      (kill-emacs 2))))