summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-10-28 14:02:46 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-10-31 11:39:03 +0100
commitaecd1be61c2d27618a594842501b58bd4ddd8991 (patch)
tree0f795c087a341b56496a2bb380ce972437d1c3f3 /Makefile.am
parentbf016cee0efa2dd3594513791f588b47fa5c456f (diff)
downloadautomake-aecd1be61c2d27618a594842501b58bd4ddd8991.tar.gz
tests: can check our recipes avoid trailing backslashes
This is related to commit v1.11-1704-g254227b of 2012-05-01, "parallel-tests: avoid trailing backslashes in make recipes", and automake bug#10436. Recipes with a trailing backslash character (possibly followed by blank characters only) can cause spurious syntax errors with at least older bash versions (e.g., bash 2.05b), and can be potentially be unportable to other weaker shells. So provide a target that runs the testsuite looking for this kind of breakage (without requiring a real bugged shell). * t/ax/shell-no-trail-bslash.in: New, a "shell" that chokes on '-c' commands having a trailing '\' (possibly followed by whitespace only). * Makefile (t/ax/shell-no-trail-bslash): Generate this script from it. (noinst_SCRIPTS, CLEANFILES): Add it. (EXTRA_DIST): Add 't/ax/shell-no-trail-bslash.in'. (check-no-trailing-backslash-in-recipes): New target, runs the testsuite with 'shell-no-trail-bslash' as the CONFIG_SHELL, to catch possible recipes having a trailing backslash character (possibly followed by * .gitignore: Update. * t/self-check-shell-no-trail-bslash.sh: New testsuite self-check. * t/parallel-tests-trailing-bslash.sh: Remove as obsolete. * t/list-of-tests.mk: Adjust. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am26
1 files changed, 25 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index a48ab82b0..45bf2fce4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -423,6 +423,19 @@ EXTRA_DIST += t/ax/test-defs.in
CLEANFILES += t/ax/test-defs.sh
nodist_noinst_DATA = t/ax/test-defs.sh
+noinst_SCRIPTS = # Will be updated soon.
+
+t/ax/shell-no-trail-bslash: t/ax/shell-no-trail-bslash.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_GEN)in=t/ax/shell-no-trail-bslash.in \
+ && $(MKDIR_P) t/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
+ $(generated_file_finalize)
+EXTRA_DIST += t/ax/shell-no-trail-bslash.in
+CLEANFILES += t/ax/shell-no-trail-bslash
+noinst_SCRIPTS += t/ax/shell-no-trail-bslash
+
runtest: runtest.in Makefile
$(AM_V_at)rm -f $@ $@-t
$(AM_V_GEN)in=runtest.in \
@@ -432,7 +445,7 @@ runtest: runtest.in Makefile
$(generated_file_finalize)
EXTRA_DIST += runtest.in
CLEANFILES += runtest
-noinst_SCRIPTS = runtest
+noinst_SCRIPTS += runtest
# If two test scripts have the same basename, they will end up sharing
# the same log file, leading to all sort of undefined and undesired
@@ -484,6 +497,17 @@ check-tests-syntax:
check-local: check-tests-syntax
.PHONY: check-tests-syntax
+# Recipes with a trailing backslash character (possibly followed by
+# blank characters only) can cause spurious syntax errors with at
+# least older bash versions (e.g., bash 2.05b), and can be potentially
+# be unportable to other weaker shells. Run the testsuite in a way
+# that helps catching such problems in Automake-generated recipes.
+# See automake bug#10436.
+check-no-trailing-backslash-in-recipes:
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ CONFIG_SHELL='$(abs_top_builddir)/t/ax/shell-no-trail-bslash'
+.PHONY: check-no-trailing-backslash-in-recipes
+
## Checking the list of tests.
test_subdirs = t t/pm
include $(srcdir)/t/CheckListOfTests.am