Print test timings unconditionally

* lisp/emacs-lisp/ert.el (ert-batch-print-duration): Remove.
(ert-run-tests-batch): Adapt accordingly.

* test/Makefile.in:
* test/README: Remove TEST_PRINT_TEST_DURATION.
This commit is contained in:
Michael Albinus 2018-03-17 10:25:22 +01:00
parent 1c7db8aa30
commit bcec2a8a39
3 changed files with 8 additions and 28 deletions

View file

@ -1342,9 +1342,6 @@ RESULT must be an `ert-test-result-with-condition'."
(defvar ert-quiet nil (defvar ert-quiet nil
"Non-nil makes ERT only print important information in batch mode.") "Non-nil makes ERT only print important information in batch mode.")
(defvar ert-batch-print-duration nil
"Non-nil makes ERT print duration time of single tests in batch mode.")
;;;###autoload ;;;###autoload
(defun ert-run-tests-batch (&optional selector) (defun ert-run-tests-batch (&optional selector)
"Run the tests specified by SELECTOR, printing results to the terminal. "Run the tests specified by SELECTOR, printing results to the terminal.
@ -1371,7 +1368,7 @@ Returns the stats object."
(let ((unexpected (ert-stats-completed-unexpected stats)) (let ((unexpected (ert-stats-completed-unexpected stats))
(skipped (ert-stats-skipped stats)) (skipped (ert-stats-skipped stats))
(expected-failures (ert--stats-failed-expected stats))) (expected-failures (ert--stats-failed-expected stats)))
(message "\n%sRan %s tests, %s results as expected%s%s (%s)%s\n" (message "\n%sRan %s tests, %s results as expected%s%s (%s, %f sec)%s\n"
(if (not abortedp) (if (not abortedp)
"" ""
"Aborted: ") "Aborted: ")
@ -1383,15 +1380,11 @@ Returns the stats object."
(if (zerop skipped) (if (zerop skipped)
"" ""
(format ", %s skipped" skipped)) (format ", %s skipped" skipped))
(if ert-batch-print-duration (ert--format-time-iso8601 (ert--stats-end-time stats))
(format (float-time
"%s, %f sec" (time-subtract
(ert--format-time-iso8601 (ert--stats-end-time stats)) (ert--stats-end-time stats)
(float-time (ert--stats-start-time stats)))
(time-subtract
(ert--stats-end-time stats)
(ert--stats-start-time stats))))
(ert--format-time-iso8601 (ert--stats-end-time stats)))
(if (zerop expected-failures) (if (zerop expected-failures)
"" ""
(format "\n%s expected failures" expected-failures))) (format "\n%s expected failures" expected-failures)))
@ -1463,17 +1456,14 @@ Returns the stats object."
(let* ((max (prin1-to-string (length (ert--stats-tests stats)))) (let* ((max (prin1-to-string (length (ert--stats-tests stats))))
(format-string (concat "%9s %" (format-string (concat "%9s %"
(prin1-to-string (length max)) (prin1-to-string (length max))
"s/" max " %S" "s/" max " %S (%f sec)")))
(if ert-batch-print-duration
" (%f sec)"))))
(message format-string (message format-string
(ert-string-for-test-result result (ert-string-for-test-result result
(ert-test-result-expected-p (ert-test-result-expected-p
test result)) test result))
(1+ (ert--stats-test-pos stats test)) (1+ (ert--stats-test-pos stats test))
(ert-test-name test) (ert-test-name test)
(if ert-batch-print-duration (ert-test-result-duration result))))))))
(ert-test-result-duration result)))))))))
nil)) nil))
;;;###autoload ;;;###autoload

View file

@ -111,11 +111,6 @@ ifneq (${TEST_BACKTRACE_LINE_LENGTH},)
ert_opts += --eval '(setq ert-batch-backtrace-right-margin ${TEST_BACKTRACE_LINE_LENGTH})' ert_opts += --eval '(setq ert-batch-backtrace-right-margin ${TEST_BACKTRACE_LINE_LENGTH})'
endif endif
# Whether the tests shall also report their duration.
ifdef TEST_PRINT_TEST_DURATION
ert_opts += --eval '(setq ert-batch-print-duration t)'
endif
ifeq (@HAVE_MODULES@, yes) ifeq (@HAVE_MODULES@, yes)
MODULES_EMACSOPT := --module-assertions MODULES_EMACSOPT := --module-assertions
else else

View file

@ -65,11 +65,6 @@ compiled version of a test use
make TEST_LOAD_EL=no ... make TEST_LOAD_EL=no ...
Sometimes, it is necessary to trace the duration time for single tests.
This is controlled by the environment variable TEST_PRINT_TEST_DURATION
make TEST_PRINT_TEST_DURATION=1 ...
(Also, see etc/compilation.txt for compilation mode font lock tests.) (Also, see etc/compilation.txt for compilation mode font lock tests.)