diff options
| author | Michael Albinus | 2018-03-17 10:25:22 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-03-17 10:25:22 +0100 |
| commit | bcec2a8a392da74df9136a13cf7acaa6b95358f7 (patch) | |
| tree | 5486012bf7f98d096f184c8a55d81e877a629d0f | |
| parent | 1c7db8aa30969d0bc0e6d35b9bd57c70314ed9d0 (diff) | |
| download | emacs-bcec2a8a392da74df9136a13cf7acaa6b95358f7.tar.gz emacs-bcec2a8a392da74df9136a13cf7acaa6b95358f7.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/ert.el | 26 | ||||
| -rw-r--r-- | test/Makefile.in | 5 | ||||
| -rw-r--r-- | test/README | 5 |
3 files changed, 8 insertions, 28 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index a15450734ec..e4e166ac678 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el | |||
| @@ -1342,9 +1342,6 @@ RESULT must be an `ert-test-result-with-condition'." | |||
| 1342 | (defvar ert-quiet nil | 1342 | (defvar ert-quiet nil |
| 1343 | "Non-nil makes ERT only print important information in batch mode.") | 1343 | "Non-nil makes ERT only print important information in batch mode.") |
| 1344 | 1344 | ||
| 1345 | (defvar ert-batch-print-duration nil | ||
| 1346 | "Non-nil makes ERT print duration time of single tests in batch mode.") | ||
| 1347 | |||
| 1348 | ;;;###autoload | 1345 | ;;;###autoload |
| 1349 | (defun ert-run-tests-batch (&optional selector) | 1346 | (defun ert-run-tests-batch (&optional selector) |
| 1350 | "Run the tests specified by SELECTOR, printing results to the terminal. | 1347 | "Run the tests specified by SELECTOR, printing results to the terminal. |
| @@ -1371,7 +1368,7 @@ Returns the stats object." | |||
| 1371 | (let ((unexpected (ert-stats-completed-unexpected stats)) | 1368 | (let ((unexpected (ert-stats-completed-unexpected stats)) |
| 1372 | (skipped (ert-stats-skipped stats)) | 1369 | (skipped (ert-stats-skipped stats)) |
| 1373 | (expected-failures (ert--stats-failed-expected stats))) | 1370 | (expected-failures (ert--stats-failed-expected stats))) |
| 1374 | (message "\n%sRan %s tests, %s results as expected%s%s (%s)%s\n" | 1371 | (message "\n%sRan %s tests, %s results as expected%s%s (%s, %f sec)%s\n" |
| 1375 | (if (not abortedp) | 1372 | (if (not abortedp) |
| 1376 | "" | 1373 | "" |
| 1377 | "Aborted: ") | 1374 | "Aborted: ") |
| @@ -1383,15 +1380,11 @@ Returns the stats object." | |||
| 1383 | (if (zerop skipped) | 1380 | (if (zerop skipped) |
| 1384 | "" | 1381 | "" |
| 1385 | (format ", %s skipped" skipped)) | 1382 | (format ", %s skipped" skipped)) |
| 1386 | (if ert-batch-print-duration | 1383 | (ert--format-time-iso8601 (ert--stats-end-time stats)) |
| 1387 | (format | 1384 | (float-time |
| 1388 | "%s, %f sec" | 1385 | (time-subtract |
| 1389 | (ert--format-time-iso8601 (ert--stats-end-time stats)) | 1386 | (ert--stats-end-time stats) |
| 1390 | (float-time | 1387 | (ert--stats-start-time stats))) |
| 1391 | (time-subtract | ||
| 1392 | (ert--stats-end-time stats) | ||
| 1393 | (ert--stats-start-time stats)))) | ||
| 1394 | (ert--format-time-iso8601 (ert--stats-end-time stats))) | ||
| 1395 | (if (zerop expected-failures) | 1388 | (if (zerop expected-failures) |
| 1396 | "" | 1389 | "" |
| 1397 | (format "\n%s expected failures" expected-failures))) | 1390 | (format "\n%s expected failures" expected-failures))) |
| @@ -1463,17 +1456,14 @@ Returns the stats object." | |||
| 1463 | (let* ((max (prin1-to-string (length (ert--stats-tests stats)))) | 1456 | (let* ((max (prin1-to-string (length (ert--stats-tests stats)))) |
| 1464 | (format-string (concat "%9s %" | 1457 | (format-string (concat "%9s %" |
| 1465 | (prin1-to-string (length max)) | 1458 | (prin1-to-string (length max)) |
| 1466 | "s/" max " %S" | 1459 | "s/" max " %S (%f sec)"))) |
| 1467 | (if ert-batch-print-duration | ||
| 1468 | " (%f sec)")))) | ||
| 1469 | (message format-string | 1460 | (message format-string |
| 1470 | (ert-string-for-test-result result | 1461 | (ert-string-for-test-result result |
| 1471 | (ert-test-result-expected-p | 1462 | (ert-test-result-expected-p |
| 1472 | test result)) | 1463 | test result)) |
| 1473 | (1+ (ert--stats-test-pos stats test)) | 1464 | (1+ (ert--stats-test-pos stats test)) |
| 1474 | (ert-test-name test) | 1465 | (ert-test-name test) |
| 1475 | (if ert-batch-print-duration | 1466 | (ert-test-result-duration result)))))))) |
| 1476 | (ert-test-result-duration result))))))))) | ||
| 1477 | nil)) | 1467 | nil)) |
| 1478 | 1468 | ||
| 1479 | ;;;###autoload | 1469 | ;;;###autoload |
diff --git a/test/Makefile.in b/test/Makefile.in index 426d22d0632..20e90c6ce50 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -111,11 +111,6 @@ ifneq (${TEST_BACKTRACE_LINE_LENGTH},) | |||
| 111 | ert_opts += --eval '(setq ert-batch-backtrace-right-margin ${TEST_BACKTRACE_LINE_LENGTH})' | 111 | ert_opts += --eval '(setq ert-batch-backtrace-right-margin ${TEST_BACKTRACE_LINE_LENGTH})' |
| 112 | endif | 112 | endif |
| 113 | 113 | ||
| 114 | # Whether the tests shall also report their duration. | ||
| 115 | ifdef TEST_PRINT_TEST_DURATION | ||
| 116 | ert_opts += --eval '(setq ert-batch-print-duration t)' | ||
| 117 | endif | ||
| 118 | |||
| 119 | ifeq (@HAVE_MODULES@, yes) | 114 | ifeq (@HAVE_MODULES@, yes) |
| 120 | MODULES_EMACSOPT := --module-assertions | 115 | MODULES_EMACSOPT := --module-assertions |
| 121 | else | 116 | else |
diff --git a/test/README b/test/README index 37156c632c1..36307e3b6c1 100644 --- a/test/README +++ b/test/README | |||
| @@ -65,11 +65,6 @@ compiled version of a test use | |||
| 65 | 65 | ||
| 66 | make TEST_LOAD_EL=no ... | 66 | make TEST_LOAD_EL=no ... |
| 67 | 67 | ||
| 68 | Sometimes, it is necessary to trace the duration time for single tests. | ||
| 69 | This is controlled by the environment variable TEST_PRINT_TEST_DURATION | ||
| 70 | |||
| 71 | make TEST_PRINT_TEST_DURATION=1 ... | ||
| 72 | |||
| 73 | 68 | ||
| 74 | (Also, see etc/compilation.txt for compilation mode font lock tests.) | 69 | (Also, see etc/compilation.txt for compilation mode font lock tests.) |
| 75 | 70 | ||