[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/gnus-select 10794c8 119/218: Print top time consum
From: |
Andrew G Cohen |
Subject: |
[Emacs-diffs] feature/gnus-select 10794c8 119/218: Print top time consuming tests if advised |
Date: |
Fri, 14 Dec 2018 03:35:13 -0500 (EST) |
branch: feature/gnus-select
commit 10794c813deba23e3b7754d55fff0663ca620c05
Author: Michael Albinus <address@hidden>
Commit: Andrew G Cohen <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.)
- [Emacs-diffs] feature/gnus-select 25950c1 095/218: Suppress warnings about obsolete generics (bug#25556), (continued)
- [Emacs-diffs] feature/gnus-select 25950c1 095/218: Suppress warnings about obsolete generics (bug#25556), Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 965f4ec 100/218: * lisp/gnus/gnus-registry.el: Add missing compile-time requirement., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select e2aebb9 090/218: * test/lisp/ses-tests.el: Quieten compilation., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select c52e2e2 099/218: Fix 'posn-at-point' when line numbers are displayed, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select e907e4a 102/218: Improve word motion docs (Bug#30815), Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 08b32c9 105/218: Print test timings unconditionally, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 58da563 110/218: * lisp/url/url-handlers.el: Require subr-x., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 513b7fc 111/218: Fix compilation warnings in subr-x-tests.el, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select aceb821 047/218: Remove many items obsolete since Emacs 22.1, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select ec18ff5 118/218: Followup to last change in browse-url.el, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 10794c8 119/218: Print top time consuming tests if advised,
Andrew G Cohen <=
- [Emacs-diffs] feature/gnus-select 1ac0958 123/218: Fix recently-added POP doc glitch, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 0f8f94d 121/218: Fix frame resize flicker on macOS (bug#30699), Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select b3c36c4 122/218: Revert move of interactive `transpose-regions' to Lisp, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 24e07c4 129/218: Tune time zone 0, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select a3605b6 130/218: * test/lisp/info-xref-tests.el (info-xref-test-emacs-manuals): New., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 15d031e 128/218: * doc/emacs/building.texi (Starting GUD): Mention 'guiler'., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select c5dd420 112/218: Move interactive `transpose-regions' to Lisp, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select abe37f8 127/218: Yet more proofreading of the Emacs manual, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 98cca72 140/218: Better support for 'transpose-chars' in Flyspell mode, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select f1168aa 139/218: Correct Info link markup, Andrew G Cohen, 2018/12/14