[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 1979bce: Print top time consuming tests if advised
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master 1979bce: Print top time consuming tests if advised |
Date: |
Mon, 19 Mar 2018 07:58:53 -0400 (EDT) |
branch: master
commit 1979bce57d1887d89de6d728bb34dcd0f6478b2f
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Print top time consuming tests if advised
* lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit):
New argument HIGH. Print top-running tests.
* test/Makefile.in (check-doit): Use ${SUMMARIZE_TESTS}.
* test/README: Explain SUMMARIZE_TESTS.
---
lisp/emacs-lisp/ert.el | 25 +++++++++++++++++++++----
test/Makefile.in | 3 ++-
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 09cf28e..32bb367 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1491,20 +1491,23 @@ the tests)."
(kill-emacs 2))))
-(defun ert-summarize-tests-batch-and-exit ()
+(defun ert-summarize-tests-batch-and-exit (&optional high)
"Summarize the results of testing.
Expects to be called in batch mode, with logfiles as command-line arguments.
The logfiles should have the `ert-run-tests-batch' format. When finished,
-this exits Emacs, with status as per `ert-run-tests-batch-and-exit'."
+this exits Emacs, with status as per `ert-run-tests-batch-and-exit'.
+
+If HIGH is a natural number, the HIGH long lasting tests are summarized."
(or noninteractive
(user-error "This function is only for use in batch mode"))
+ (or (natnump high) (setq high 0))
;; Better crash loudly than attempting to recover from undefined
;; behavior.
(setq attempt-stack-overflow-recovery nil
attempt-orderly-shutdown-on-fatal-signal nil)
(let ((nlogs (length command-line-args-left))
(ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0)
- nnotrun logfile notests badtests unexpected skipped)
+ nnotrun logfile notests badtests unexpected skipped tests)
(with-temp-buffer
(while (setq logfile (pop command-line-args-left))
(erase-buffer)
@@ -1527,7 +1530,15 @@ Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\
(when (match-string 5)
(push logfile skipped)
(setq nskipped (+ nskipped
- (string-to-number (match-string 5)))))))))
+ (string-to-number (match-string 5)))))
+ (unless (zerop high)
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (if (looking-at
"^\\s-+\\w+\\s-+[[:digit:]]+/[[:digit:]]+\\s-+\\S-+\\s-+(\\([.[:digit:]]+\\)\\s-+sec)$")
+ (push (cons (string-to-number (match-string 1))
+ (match-string 0))
+ tests))
+ (forward-line)))))))
(setq nnotrun (- ntests nrun))
(message "\nSUMMARY OF TEST RESULTS")
(message "-----------------------")
@@ -1558,6 +1569,12 @@ Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\
(when unexpected
(message "%d files contained unexpected results:" (length unexpected))
(mapc (lambda (l) (message " %s" l)) unexpected))
+ (unless (or (null tests) (zerop high))
+ (message "\nLONG-RUNNING TESTS")
+ (message "------------------")
+ (setq tests (sort tests (lambda (x y) (> (car x) (car y)))))
+ (when (< high (length tests)) (setcdr (nthcdr (1- high) tests) nil))
+ (message "%s" (mapconcat 'cdr tests "\n")))
;; More details on hydra, where the logs are harder to get to.
(when (and (getenv "EMACS_HYDRA_CI")
(not (zerop (+ nunexpected nskipped))))
diff --git a/test/Makefile.in b/test/Makefile.in
index 20e90c6..bf1f9f3 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -277,7 +277,8 @@ check-maybe: check-no-automated-subdir
## summarizing step from running when there is an error.
check-doit:
address@hidden -k ${LOGFILES}
- @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit ${LOGFILES}
+ @$(emacs) -l ert --eval \
+ "(ert-summarize-tests-batch-and-exit ${SUMMARIZE_TESTS})" ${LOGFILES}
.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
diff --git a/test/README b/test/README
index 36307e3..b9f6f65 100644
--- a/test/README
+++ b/test/README
@@ -65,6 +65,11 @@ compiled version of a test use
make TEST_LOAD_EL=no ...
+Some tests might take long time to run. In order to summarize the
+<nn> tests with the longest duration, call
+
+ make SUMMARIZE_TESTS=<nn> ...
+
(Also, see etc/compilation.txt for compilation mode font lock tests.)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 1979bce: Print top time consuming tests if advised,
Michael Albinus <=