diff options
| -rw-r--r-- | lisp/emacs-lisp/ert.el | 25 | ||||
| -rw-r--r-- | test/Makefile.in | 3 | ||||
| -rw-r--r-- | test/README | 5 |
3 files changed, 28 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 09cf28e38ba..32bb367cdb3 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el | |||
| @@ -1491,20 +1491,23 @@ the tests)." | |||
| 1491 | (kill-emacs 2)))) | 1491 | (kill-emacs 2)))) |
| 1492 | 1492 | ||
| 1493 | 1493 | ||
| 1494 | (defun ert-summarize-tests-batch-and-exit () | 1494 | (defun ert-summarize-tests-batch-and-exit (&optional high) |
| 1495 | "Summarize the results of testing. | 1495 | "Summarize the results of testing. |
| 1496 | Expects to be called in batch mode, with logfiles as command-line arguments. | 1496 | Expects to be called in batch mode, with logfiles as command-line arguments. |
| 1497 | The logfiles should have the `ert-run-tests-batch' format. When finished, | 1497 | The logfiles should have the `ert-run-tests-batch' format. When finished, |
| 1498 | this exits Emacs, with status as per `ert-run-tests-batch-and-exit'." | 1498 | this exits Emacs, with status as per `ert-run-tests-batch-and-exit'. |
| 1499 | |||
| 1500 | If HIGH is a natural number, the HIGH long lasting tests are summarized." | ||
| 1499 | (or noninteractive | 1501 | (or noninteractive |
| 1500 | (user-error "This function is only for use in batch mode")) | 1502 | (user-error "This function is only for use in batch mode")) |
| 1503 | (or (natnump high) (setq high 0)) | ||
| 1501 | ;; Better crash loudly than attempting to recover from undefined | 1504 | ;; Better crash loudly than attempting to recover from undefined |
| 1502 | ;; behavior. | 1505 | ;; behavior. |
| 1503 | (setq attempt-stack-overflow-recovery nil | 1506 | (setq attempt-stack-overflow-recovery nil |
| 1504 | attempt-orderly-shutdown-on-fatal-signal nil) | 1507 | attempt-orderly-shutdown-on-fatal-signal nil) |
| 1505 | (let ((nlogs (length command-line-args-left)) | 1508 | (let ((nlogs (length command-line-args-left)) |
| 1506 | (ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0) | 1509 | (ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0) |
| 1507 | nnotrun logfile notests badtests unexpected skipped) | 1510 | nnotrun logfile notests badtests unexpected skipped tests) |
| 1508 | (with-temp-buffer | 1511 | (with-temp-buffer |
| 1509 | (while (setq logfile (pop command-line-args-left)) | 1512 | (while (setq logfile (pop command-line-args-left)) |
| 1510 | (erase-buffer) | 1513 | (erase-buffer) |
| @@ -1527,7 +1530,15 @@ Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\ | |||
| 1527 | (when (match-string 5) | 1530 | (when (match-string 5) |
| 1528 | (push logfile skipped) | 1531 | (push logfile skipped) |
| 1529 | (setq nskipped (+ nskipped | 1532 | (setq nskipped (+ nskipped |
| 1530 | (string-to-number (match-string 5))))))))) | 1533 | (string-to-number (match-string 5))))) |
| 1534 | (unless (zerop high) | ||
| 1535 | (goto-char (point-min)) | ||
| 1536 | (while (< (point) (point-max)) | ||
| 1537 | (if (looking-at "^\\s-+\\w+\\s-+[[:digit:]]+/[[:digit:]]+\\s-+\\S-+\\s-+(\\([.[:digit:]]+\\)\\s-+sec)$") | ||
| 1538 | (push (cons (string-to-number (match-string 1)) | ||
| 1539 | (match-string 0)) | ||
| 1540 | tests)) | ||
| 1541 | (forward-line))))))) | ||
| 1531 | (setq nnotrun (- ntests nrun)) | 1542 | (setq nnotrun (- ntests nrun)) |
| 1532 | (message "\nSUMMARY OF TEST RESULTS") | 1543 | (message "\nSUMMARY OF TEST RESULTS") |
| 1533 | (message "-----------------------") | 1544 | (message "-----------------------") |
| @@ -1558,6 +1569,12 @@ Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\ | |||
| 1558 | (when unexpected | 1569 | (when unexpected |
| 1559 | (message "%d files contained unexpected results:" (length unexpected)) | 1570 | (message "%d files contained unexpected results:" (length unexpected)) |
| 1560 | (mapc (lambda (l) (message " %s" l)) unexpected)) | 1571 | (mapc (lambda (l) (message " %s" l)) unexpected)) |
| 1572 | (unless (or (null tests) (zerop high)) | ||
| 1573 | (message "\nLONG-RUNNING TESTS") | ||
| 1574 | (message "------------------") | ||
| 1575 | (setq tests (sort tests (lambda (x y) (> (car x) (car y))))) | ||
| 1576 | (when (< high (length tests)) (setcdr (nthcdr (1- high) tests) nil)) | ||
| 1577 | (message "%s" (mapconcat 'cdr tests "\n"))) | ||
| 1561 | ;; More details on hydra, where the logs are harder to get to. | 1578 | ;; More details on hydra, where the logs are harder to get to. |
| 1562 | (when (and (getenv "EMACS_HYDRA_CI") | 1579 | (when (and (getenv "EMACS_HYDRA_CI") |
| 1563 | (not (zerop (+ nunexpected nskipped)))) | 1580 | (not (zerop (+ nunexpected nskipped)))) |
diff --git a/test/Makefile.in b/test/Makefile.in index 20e90c6ce50..bf1f9f39b71 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -277,7 +277,8 @@ check-maybe: check-no-automated-subdir | |||
| 277 | ## summarizing step from running when there is an error. | 277 | ## summarizing step from running when there is an error. |
| 278 | check-doit: | 278 | check-doit: |
| 279 | -@${MAKE} -k ${LOGFILES} | 279 | -@${MAKE} -k ${LOGFILES} |
| 280 | @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit ${LOGFILES} | 280 | @$(emacs) -l ert --eval \ |
| 281 | "(ert-summarize-tests-batch-and-exit ${SUMMARIZE_TESTS})" ${LOGFILES} | ||
| 281 | 282 | ||
| 282 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean | 283 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean |
| 283 | 284 | ||
diff --git a/test/README b/test/README index 36307e3b6c1..b9f6f65c450 100644 --- a/test/README +++ b/test/README | |||
| @@ -65,6 +65,11 @@ compiled version of a test use | |||
| 65 | 65 | ||
| 66 | make TEST_LOAD_EL=no ... | 66 | make TEST_LOAD_EL=no ... |
| 67 | 67 | ||
| 68 | Some tests might take long time to run. In order to summarize the | ||
| 69 | <nn> tests with the longest duration, call | ||
| 70 | |||
| 71 | make SUMMARIZE_TESTS=<nn> ... | ||
| 72 | |||
| 68 | 73 | ||
| 69 | (Also, see etc/compilation.txt for compilation mode font lock tests.) | 74 | (Also, see etc/compilation.txt for compilation mode font lock tests.) |
| 70 | 75 | ||