From e36003d0cf689ab737e774ea5faa07b2375e0d0a Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 14 Mar 2011 12:44:53 +0100 Subject: [PATCH] maintcheck: look for problematic names of testcases The configure.in stub created by default by `tests/defs' obtains the first argument of AC_INIT from the test name, and this can cause some supported autoconf versions to fail with a spurious error if that test name contains the name of an m4 or m4sugar builtin or macro (e.g., `defn' or `m4_undefine'). See for example the bug fixed by commit v1.11-287-g1325a8a. This change add a maintainer check that warns about test names which are possibly problematic in this regard. * Makefile.am (sc_test_names): New maintainer-check target. (syntax_check_rules): Add it. (m4_builtins): New helper variable. (TESTS): Updated according to the following renamings. * tests/include.test: Renamed ... * tests/hdr-vars-defined-once.test: ... to this. * tests/sinclude.test: Renamed ... * tests/m4-inclusion.test: ... to this, and simplified accordingly. * tests/include2.test: Renamed ... * tests/dist-included-parent-dir.test: ... to this, for consistency. --- ChangeLog | 25 ++++++++ Makefile.am | 61 +++++++++++++++++++ Makefile.in | 58 ++++++++++++++++++ tests/Makefile.am | 6 +- tests/Makefile.in | 6 +- ...de2.test => dist-included-parent-dir.test} | 0 ...nclude.test => hdr-vars-defined-once.test} | 0 tests/{sinclude.test => m4-inclusion.test} | 8 +-- 8 files changed, 151 insertions(+), 13 deletions(-) rename tests/{include2.test => dist-included-parent-dir.test} (100%) rename tests/{include.test => hdr-vars-defined-once.test} (100%) rename tests/{sinclude.test => m4-inclusion.test} (83%) diff --git a/ChangeLog b/ChangeLog index 804fae6f7..d2865ea06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2011-03-17 Stefano Lattarini + Ralf Wildenhues + + maintcheck: look for problematic names of testcases + The configure.in stub created by default by `tests/defs' obtains + the first argument of AC_INIT from the test name, and this can + cause some supported autoconf versions to fail with a spurious + error if that test name contains the name of an m4 or m4sugar + builtin or macro (e.g., `defn' or `m4_undefine'). + See for example the bug fixed by commit v1.11-287-g1325a8a. + This change add a maintainer check that warns about test names + which are possibly problematic in this regard. + * Makefile.am (sc_test_names): New maintainer-check target. + (syntax_check_rules): Add it. + (m4_builtins): New helper variable. + (TESTS): Updated according to the following renamings. + * tests/include.test: Renamed ... + * tests/hdr-vars-defined-once.test: ... to this. + * tests/sinclude.test: Renamed ... + * tests/m4-inclusion.test: ... to this, and simplified + accordingly. + * tests/include2.test: Renamed ... + * tests/dist-included-parent-dir.test: ... to this, for + consistency. + 2011-03-04 Stefano Lattarini tests: fix bug in alloca*.test diff --git a/Makefile.am b/Makefile.am index d19d974be..316619f3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -111,6 +111,7 @@ dist-hook: # Some simple checks, and then ordinary check. These are only really # guaranteed to work on my machine. syntax_check_rules = \ +sc_test_names \ sc_diff_automake_in_automake \ sc_perl_syntax \ sc_no_brace_variable_expansions \ @@ -151,6 +152,66 @@ sc_at_in_texi $(syntax_check_rules): automake aclocal maintainer-check: $(syntax_check_rules) +## Look for test whose names can cause spurious failures when used as +## first argument to AC_INIT (chiefly because they might contain an +## m4/m4sugar builtin or macro name). +m4_builtins = \ + __gnu__ \ + __unix__ \ + bpatsubst \ + bregexp \ + builtin \ + changecom \ + changequote \ + changeword \ + debugfile \ + debugmode \ + decr \ + define \ + defn \ + divert \ + divnum \ + dnl \ + dumpdef \ + errprint \ + esyscmd \ + eval \ + format \ + ifdef \ + ifelse \ + include \ + incr \ + index \ + indir \ + len \ + m4exit \ + m4wrap \ + maketemp \ + mkstemp \ + patsubst \ + popdef \ + pushdef \ + regexp \ + shift \ + sinclude \ + substr \ + symbols \ + syscmd \ + sysval \ + traceoff \ + traceon \ + translit \ + undefine \ + undivert +sc_test_names: + @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \ + m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \ + if ls tests/*.test | LC_ALL=C grep -E "$$m4_macro_rx"; then \ + echo "the names of the tests above can be problematic" 1>&2; \ + echo "Avoid test names that contain names of m4 macros" 1>&2; \ + exit 1; \ + fi + ## This check avoids accidental configure substitutions in the source. ## There are exactly 8 lines that should be modified. This works out ## to 28 lines of diffs. diff --git a/Makefile.in b/Makefile.in index 25d580d60..ec327ed5b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -269,6 +269,7 @@ do_subst = sed \ # Some simple checks, and then ordinary check. These are only really # guaranteed to work on my machine. syntax_check_rules = \ +sc_test_names \ sc_diff_automake_in_automake \ sc_perl_syntax \ sc_no_brace_variable_expansions \ @@ -305,6 +306,55 @@ sc_unquoted_DESTDIR \ sc_tabs_in_texi \ sc_at_in_texi +m4_builtins = \ + __gnu__ \ + __unix__ \ + bpatsubst \ + bregexp \ + builtin \ + changecom \ + changequote \ + changeword \ + debugfile \ + debugmode \ + decr \ + define \ + defn \ + divert \ + divnum \ + dnl \ + dumpdef \ + errprint \ + esyscmd \ + eval \ + format \ + ifdef \ + ifelse \ + include \ + incr \ + index \ + indir \ + len \ + m4exit \ + m4wrap \ + maketemp \ + mkstemp \ + patsubst \ + popdef \ + pushdef \ + regexp \ + shift \ + sinclude \ + substr \ + symbols \ + syscmd \ + sysval \ + traceoff \ + traceon \ + translit \ + undefine \ + undivert + WGET = wget WGET_SV_CVS = $(WGET) http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/ WGET_SV_GIT_CF = $(WGET) 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f=' @@ -879,6 +929,14 @@ dist-hook: .PHONY: $(syntax_check_rules) $(syntax_check_rules): automake aclocal maintainer-check: $(syntax_check_rules) +sc_test_names: + @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \ + m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \ + if ls tests/*.test | LC_ALL=C grep -E "$$m4_macro_rx"; then \ + echo "the names of the tests above can be problematic" 1>&2; \ + echo "Avoid test names that contain names of m4 macros" 1>&2; \ + exit 1; \ + fi sc_diff_automake_in_automake: @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 3fdb90aad..4becdbb1d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -288,6 +288,7 @@ dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ +dist-included-parent-dir.test \ distcleancheck.test \ distcom2.test \ distcom3.test \ @@ -362,6 +363,7 @@ gnuwarn2.test \ gnits.test \ gnits2.test \ gnits3.test \ +hdr-vars-defined-once.test \ header.test \ help.test \ help2.test \ @@ -381,8 +383,6 @@ help-upc.test \ hfs.test \ hosts.test \ implicit.test \ -include.test \ -include2.test \ info.test \ init.test \ init2.test \ @@ -487,6 +487,7 @@ ltlibobjs.test \ ltlibsrc.test \ ltorder.test \ lzma.test \ +m4-inclusion.test \ maintclean.test \ make.test \ makej.test \ @@ -662,7 +663,6 @@ silent-lex-gcc.test \ silent-lex-generic.test \ silent-yacc-gcc.test \ silent-yacc-generic.test \ -sinclude.test \ srcsub.test \ srcsub2.test \ space.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index cd008336a..b9b1f6e13 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -558,6 +558,7 @@ dirforbid.test \ dirlist.test \ dirlist2.test \ discover.test \ +dist-included-parent-dir.test \ distcleancheck.test \ distcom2.test \ distcom3.test \ @@ -632,6 +633,7 @@ gnuwarn2.test \ gnits.test \ gnits2.test \ gnits3.test \ +hdr-vars-defined-once.test \ header.test \ help.test \ help2.test \ @@ -651,8 +653,6 @@ help-upc.test \ hfs.test \ hosts.test \ implicit.test \ -include.test \ -include2.test \ info.test \ init.test \ init2.test \ @@ -757,6 +757,7 @@ ltlibobjs.test \ ltlibsrc.test \ ltorder.test \ lzma.test \ +m4-inclusion.test \ maintclean.test \ make.test \ makej.test \ @@ -932,7 +933,6 @@ silent-lex-gcc.test \ silent-lex-generic.test \ silent-yacc-gcc.test \ silent-yacc-generic.test \ -sinclude.test \ srcsub.test \ srcsub2.test \ space.test \ diff --git a/tests/include2.test b/tests/dist-included-parent-dir.test similarity index 100% rename from tests/include2.test rename to tests/dist-included-parent-dir.test diff --git a/tests/include.test b/tests/hdr-vars-defined-once.test similarity index 100% rename from tests/include.test rename to tests/hdr-vars-defined-once.test diff --git a/tests/sinclude.test b/tests/m4-inclusion.test similarity index 83% rename from tests/sinclude.test rename to tests/m4-inclusion.test index cc8898be6..025d44fec 100755 --- a/tests/sinclude.test +++ b/tests/m4-inclusion.test @@ -20,13 +20,7 @@ set -e -# Overwrite configure.in, because the default uses `sinclude' as package -# name and this play havoc with Autoconf on some platforms (`sinclude' -# is an m4 macro). -cat > configure.in <> configure.in <<'EOF' sinclude([doesntexist.m4]) EOF -- 2.47.2