]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test: make bug-reporting message on test failure more explicit.
authorKarl Berry <karl@freefriends.org>
Sat, 3 Feb 2024 16:38:49 +0000 (08:38 -0800)
committerKarl Berry <karl@freefriends.org>
Sat, 3 Feb 2024 16:38:49 +0000 (08:38 -0800)
From https://bugs.gnu.org/68855.

* NEWS: mention this.
* lib/am/check.am ($(TEST_SUITE_LOG)) <please_report>: new fn,
new wording.
* t/ax/test-defs.in (failure_footer_text): new wording.
(failure_footer_text_colorized): add red.
* t/ax/tap-summary-aux.sh (failure_footer): use failure_footer_text*.
* t/tap-doc2.sh: change grep.
* t/testsuite-summary-color.sh: likewise.
* t/testsuite-summary-count-many.sh: likewise.
* t/testsuite-summary-count.sh: likewise.
* t/testsuite-summary-reference-log.sh: likewise.

NEWS
lib/am/check.am
t/ax/tap-summary-aux.sh
t/ax/test-defs.in
t/tap-doc2.sh
t/testsuite-summary-color.sh
t/testsuite-summary-count-many.sh
t/testsuite-summary-count.sh
t/testsuite-summary-reference-log.sh

diff --git a/NEWS b/NEWS
index 153cb7733941d9ebaebd9c8405377f318a4909a7..964d82e8ca6d96e8e3a918292f9c2687dd52cf7b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,10 @@ New in 1.17:
   - The missing script also supports autoreconf, autogen, and perl.
     (https://lists.gnu.org/archive/html/automake-patches/2015-08/msg00000.html)
 
+  - test-suite.log now contains basic system information, and the
+    console message about bug reporting on failure has a bit more detail.
+    (bug#68746)
+
 * Bugs fixed
 
   - Generated file timestamp checks handle filesystems with sub-second
index d210172a6488be340e49e6c78a75171e4d6d7947..b6fa3aaad37ac88fc8002eadd3fe874988b56c17 100644 (file)
@@ -246,6 +246,7 @@ am--force-recheck:
 ## Exists only to be overridden.  See bug#11745.
 AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
 
+## emacs-page
 $(TEST_SUITE_LOG): $(TEST_LOGS)
        @$(am__set_TESTS_bases); \
 ## Helper shell function, tells whether a path refers to an existing,
@@ -360,7 +361,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
          result_count $$1 "ERROR:" $$error "$$mgn"; \
        }; \
 ##
-## Write some basic system info in the log. 
+## Function to write some basic system info in the log. 
        output_system_information () \
        { \
 ## Omit the hostname for privacy.  In practice it's a single word?
@@ -372,6 +373,16 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
            cat /etc/issue;                        \
          fi;                                      \
        }; \
+##
+## Function to output the "please report bugs" message.
+       please_report () \
+       { \
+echo "Some test(s) failed.  Please report this to $(PACKAGE_BUGREPORT),";    \
+echo "together with the test-suite.log file (gzipped) and your system";      \
+echo "information.  Thanks.";                                                \
+       }; \
+##
+## emacs-page
 ## Write "global" testsuite log.
        {                                                               \
          echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
@@ -379,8 +390,10 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
          create_testsuite_report --no-color;                           \
          output_system_information;                                    \
          echo;                                                         \
-## What is this line for? It seems to be intended for machine parsing,
-## but I can't find any other reference to it. --karl, 27jan24.
+## What is this line for? It's a Sphinx reStructuredText directive that
+## would insert a table of contents that goes two levels deep on headings.
+## But why is it in test-suite.log? No other references to it are evident.
+## Please inform automake@gnu.org.
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
          for b in $$bases; do echo $$b; done                           \
@@ -403,9 +416,9 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        create_testsuite_report --maybe-color;                          \
        echo "$$col$$br$$std";                                          \
        if $$success; then :; else                                      \
-         echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
+         echo "$${col}See $(subdir)/$(TEST_SUITE_LOG) for debugging.$${std}";\
          if test -n "$(PACKAGE_BUGREPORT)"; then                       \
-           echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+           please_report | sed -e "s/^/$${col}/" -e s/'$$'/"$${std}"/; \
          fi;                                                           \
          echo "$$col$$br$$std";                                        \
        fi;                                                             \
index d1e2888c3bef6e63ffed7145be9f7f54853a022a..a709f1ef3f636c5aef68f5b679edec98337dbe20 100644 (file)
@@ -87,8 +87,17 @@ if test $use_colors = yes; then
   mgn="$esc[0;35m"
   brg="$esc[1m"
   std="$esc[m"
+  failure_footer="\
+${red}${br}${std}
+$failure_footer_text_colorized
+${red}${br}${std}"
+
 else
   red= grn= lgn= blu= mgn= brg= std=
+  failure_footer="\
+${red}${br}${std}
+$failure_footer_text
+${red}${br}${std}"
 fi
 
   success_header="\
@@ -101,12 +110,6 @@ ${grn}${br}${std}"
   failure_header="\
 ${red}${br}${std}
 ${red}Testsuite summary for GNU AutoTAP 5.12${std}
-${red}${br}${std}"
-
-  failure_footer="\
-${red}${br}${std}
-${red}See ./test-suite.log${std}
-${red}Please report to bug-automake@gnu.org${std}
 ${red}${br}${std}"
 
 $ACLOCAL
index 8ea842355cca9e440ab41ce3ed1f0585ba75fd8d..c1ead418ebeaf444d74513a3d095607132c1287e 100644 (file)
@@ -215,6 +215,20 @@ sleep="sleep $MTIME_RESOLUTION"
 # in UTC; see <https://www.gnu.org/gnu/initial-announcement.html>.
 old_timestamp=198309271735.59
 
+# We need this in multiple tests and the wording is subject to change.
+# Don't include the ${br} lines since br is not defined at this point.
+#
+failure_footer_text="\
+See ./test-suite.log for debugging.
+Some test(s) failed.  Please report this to bug-automake@gnu.org,
+together with the test-suite.log file (gzipped) and your system
+information.  Thanks."
+#
+# And with color.
+red='\e[0;31m'
+std='\e[m';
+failure_footer_text_colorized="`echo \"$failure_footer_text\" | sed -e "s/^/${red}/" -e s/'$'/"${std}"/`"
+
 # Make our wrapper script (or installed scripts, if running under
 # "installcheck") accessible by default.  And avoid uselessly
 # extending $PATH multiple times if this file is sourced multiple times.
index fdca66ad8f1e5b3e18b2a08aa6b78fb2035088af..54c69b631455b99e767cd50197090daceee60193 100644 (file)
@@ -102,7 +102,7 @@ cat exp
 cat got
 diff exp got
 
-grep '^Please report to bug-automake@gnu\.org$' stdout
+grep 'Please report this to bug-automake@gnu\.org' stdout
 
 run_make -O check \
   TESTS='foo.test baz.test' \
index 7b6254f61c9004623465ce881c3722c623a42241..ffbe5c158d16e8eba681aa2d84dd6f0485cdcb27 100644 (file)
@@ -46,8 +46,7 @@ ${red}${br}${std}"
 
 failure_footer="\
 ${red}${br}${std}
-${red}See ./test-suite.log${std}
-${red}Please report to bug-automake@gnu.org${std}
+$failure_footer_text_colorized
 ${red}${br}${std}"
 
 do_check '' <<END
index 2560ef82cd7118b4f6f212380667afe34ff4a2a5..3cb5a500c75e165c76b20bb74860b7274dd3ec25 100644 (file)
@@ -34,7 +34,7 @@ ${br}"
 
 footer="\
 ${br}
-See ./test-suite.log
+See ./test-suite.log for debugging.
 ${br}"
 
 echo AC_OUTPUT >> configure.ac
index c8f15389dbf1008bf8810783759ba15cb2271707..9cd2fa58ef2b68e5999a6c452b2150c5232d409b 100644 (file)
@@ -32,8 +32,7 @@ success_footer=${br}
 
 failure_footer="\
 ${br}
-See ./test-suite.log
-Please report to bug-automake@gnu.org
+$failure_footer_text
 ${br}"
 
 # Corner cases.
index 64cc4eb6c7b945e980bff0e1ba20ae4003bb1d9e..f27e6fc39a335cd9cebbc89d15157b865055e1f2 100644 (file)
@@ -46,11 +46,11 @@ cd build
 ../configure
 
 run_make -O -e FAIL check
-grep '^See \./my_test_suite\.log$' stdout
+grep '^See \./my_test_suite\.log for debugging\.$' stdout
 
 mkdir bar
 run_make -O -e FAIL TEST_SUITE_LOG=bar/bar.log check
-grep '^See \./bar/bar\.log$' stdout
+grep '^See \./bar/bar\.log for debugging\.$' stdout
 
 cd ..
 
@@ -70,13 +70,13 @@ $AUTOMAKE
 
 ./configure
 run_make -O -e FAIL check
-grep '^See sub/test-suite\.log$' stdout
+grep '^See sub/test-suite\.log for debugging\.$' stdout
 cd sub
 run_make -O -e FAIL check
-grep '^See sub/test-suite\.log$' stdout
+grep '^See sub/test-suite\.log for debugging\.$' stdout
 cd ..
 
 run_make -O -e FAIL TEST_SUITE_LOG=foo.log check
-grep '^See sub/foo\.log$' stdout
+grep '^See sub/foo\.log for debugging\.$' stdout
 
 :