From 4d866fc0f561b023cbc15ee52891cddfa1a354ef Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 21 Jan 2022 12:32:10 +0100 Subject: [PATCH] Interpret a "" value of EMACS_TEST_VERBOSE as "off" * doc/misc/ert.texi (Running Tests in Batch Mode): Adjust doc. * lisp/emacs-lisp/ert.el (ert-run-tests-batch): Allow overriding the EMACS_TEST_VERBOSE variable by setting it to "" (bug#53313). --- doc/misc/ert.texi | 5 +++-- lisp/emacs-lisp/ert.el | 6 ++++-- test/README | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 0d01efb0355..91288db45a2 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -444,8 +444,9 @@ emacs -batch -l ert -l my-tests.el \ @vindex EMACS_TEST_VERBOSE@r{, environment variable} By default, ERT test failure summaries are quite brief in batch mode---only the names of the failed tests are listed. If the -@env{EMACS_TEST_VERBOSE} environment variable is set, the failure -summaries will also include the data from the failing test. +@env{EMACS_TEST_VERBOSE} environment variable is set and is non-empty, +the failure summaries will also include the data from the failing +test. @vindex EMACS_TEST_JUNIT_REPORT@r{, environment variable} ERT can produce JUnit test reports in batch mode. If the environment diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 9c6b0e15bbe..b6c5b7d6b91 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1423,7 +1423,8 @@ Returns the stats object." (message "%9s %S%s" (ert-string-for-test-result result nil) (ert-test-name test) - (if (getenv "EMACS_TEST_VERBOSE") + (if (cl-plusp + (length (getenv "EMACS_TEST_VERBOSE"))) (ert-reason-for-test-result result) "")))) (message "%s" "")) @@ -1435,7 +1436,8 @@ Returns the stats object." (message "%9s %S%s" (ert-string-for-test-result result nil) (ert-test-name test) - (if (getenv "EMACS_TEST_VERBOSE") + (if (cl-plusp + (length (getenv "EMACS_TEST_VERBOSE"))) (ert-reason-for-test-result result) "")))) (message "%s" "")) diff --git a/test/README b/test/README index e44c4a43eeb..2ab34ba20ee 100644 --- a/test/README +++ b/test/README @@ -111,8 +111,8 @@ debugging. To do that, use By default, ERT test failure summaries are quite brief in batch mode--only the names of the failed tests are listed. If the -$EMACS_TEST_VERBOSE environment variable is set, the failure summaries -will also include the data from the failing test. +$EMACS_TEST_VERBOSE environment variable is set and non-empty, the +failure summaries will also include the data from the failing test. If the $EMACS_TEST_JUNIT_REPORT environment variable is set to a file name, a JUnit test report is generated under this name.