From 5feae5cfabd0d36e021a4d0ae21f94e88a934159 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 20 Jun 2025 18:06:20 -0700 Subject: [PATCH] automake: improve debuggability of installcheck failures. From https://bugs.gnu.org/78850. * lib/am/progs.am (installcheck-%DIR%PROGRAMS): Show the cause of each failure. * lib/am/scripts.am (installcheck-%DIR%SCRIPTS): Likewise. * NEWS: mention this. --- NEWS | 2 ++ lib/am/progs.am | 25 ++++++++++++++++++++----- lib/am/scripts.am | 25 ++++++++++++++++++++----- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index ac1930971..35c36a7fe 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ please see NEWS-future and start following the advice there now. * Bugs fixed + - Improve debuggability of installcheck failures. (bug#78850) + - Keep Automake tests working when SOURCE_DATE_EPOCH is set. (https://lists.gnu.org/archive/html/automake/2025-06/msg00016.html) diff --git a/lib/am/progs.am b/lib/am/progs.am index 4be52e5e3..e44289f22 100644 --- a/lib/am/progs.am +++ b/lib/am/progs.am @@ -137,11 +137,26 @@ installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS) ## Insert the directory back if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ for opt in --help --version; do \ - if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \ - 2>c$${pid}_.err &2; bad=1; fi; \ + "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt \ + >c$${pid}_.out 2>c$${pid}_.err &2; \ + cat c$${pid}_.err 1>&2; \ + bad=1; \ + else \ + if test -z "`cat c$${pid}_.out`"; then \ + echo "$$f does not support $$opt: no output" 1>&2; \ + bad=1; \ + else \ + if test $$xc != 0; then \ + echo "$$f does not support $$opt: exit code $$xc" 1>&2; \ + bad=1; \ + else \ + :; \ + fi; \ + fi; \ + fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad endif %?CK-OPTS% diff --git a/lib/am/scripts.am b/lib/am/scripts.am index 2d0a1c768..966c0b83f 100644 --- a/lib/am/scripts.am +++ b/lib/am/scripts.am @@ -117,11 +117,26 @@ installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS) ## Insert the directory back if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ for opt in --help --version; do \ - if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \ - 2>c$${pid}_.err &2; bad=1; fi; \ + "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt \ + >c$${pid}_.out 2>c$${pid}_.err &2; \ + cat c$${pid}_.err 1>&2; \ + bad=1; \ + else \ + if test -z "`cat c$${pid}_.out`"; then \ + echo "$$f does not support $$opt: no output" 1>&2; \ + bad=1; \ + else \ + if test $$xc != 0; then \ + echo "$$f does not support $$opt: exit code $$xc" 1>&2; \ + bad=1; \ + else \ + :; \ + fi; \ + fi; \ + fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad endif %?CK-OPTS% -- 2.47.3