I pushed this patch to tests-init. Regards, Stefano
-*-*-*- Tests defs: keep track of original $AUTOMAKE and $ACLOCAL values. This is especially useful for tests which might want to run automake and aclocal without additional flags and warnings. * tests/defs-static.in ($original_ACLOCAL): New variable. ($original_AUTOMAKE): Likewise. * tests/help.test: Use them. * tests/help2.test: Likewise. * tests/help3.test: Likewise. * tests/help4.test: Likewise. From a suggestion by Ralf Wildenhues. --- ChangeLog | 13 +++++++++++++ tests/defs-static.in | 22 ++++++++++++++++++---- tests/help.test | 7 ++++--- tests/help2.test | 7 ++++--- tests/help3.test | 7 ++++--- tests/help4.test | 7 ++++--- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad68203..378742e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-12-22 Stefano Lattarini <stefano.lattar...@gmail.com> + + Tests defs: keep track of original $AUTOMAKE and $ACLOCAL values. + This is especially useful for tests which might want to run + automake and aclocal without additional flags and warnings. + * tests/defs-static.in ($original_ACLOCAL): New variable. + ($original_AUTOMAKE): Likewise. + * tests/help.test: Use them. + * tests/help2.test: Likewise. + * tests/help3.test: Likewise. + * tests/help4.test: Likewise. + From a suggestion by Ralf Wildenhues. + 2010-12-13 Stefano Lattarini <stefano.lattar...@gmail.com> Ralf Wildenhues <ralf.wildenh...@gmx.de> diff --git a/tests/defs-static.in b/tests/defs-static.in index 2ca4b57..c4ae758 100644 --- a/tests/defs-static.in +++ b/tests/defs-static.in @@ -51,8 +51,16 @@ test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@" test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@" test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate test -z "$MISSING" && MISSING=$top_testsrcdir/lib/missing + # Use -Werror because this also turns some Perl warnings into error. -# (Tests for which this is inappropriate should use -Wno-error.) +# Tests for which this is inappropriate should use -Wno-error. +# Tests who want complete control over aclocal command-line options +# should use $original_ACLOCAL. +# Note: the first `test -z' conditional below is to ensure defs-static +# really remains idempotent. +if test -z "$original_ACLOCAL"; then + original_ACLOCAL=${ACLOCAL-"aclocal-$APIVERSION"} +fi test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror" # Extra flags to pass to aclocal before all other flags added by this script. ACLOCAL_TESTSUITE_FLAGS=''; export ACLOCAL_TESTSUITE_FLAGS @@ -60,9 +68,15 @@ ACLOCAL_TESTSUITE_FLAGS=''; export ACLOCAL_TESTSUITE_FLAGS # See how Automake should be run. We put --foreign as the default # strictness to avoid having to create lots and lots of files. A test # can override this by specifying a different strictness. Use -Wall -# -Werror by default. Tests for which this is inappropriate -# (e.g. when testing that a warning is enabled by a specific switch) -# should use -Wnone or/and -Wno-error +# -Werror by default. Tests for which this is inappropriate (e.g. when +# testing that a warning is enabled by a specific switch) should use +# -Wnone or/and -Wno-error. Tests who want complete control over +# automake command-line options should use $original_AUTOMAKE. +# Note: the first `test -z' conditional below is to ensure defs-static +# really remains idempotent. +if test -z "$original_AUTOMAKE"; then + original_AUTOMAKE=${AUTOMAKE-"automake-$APIVERSION"} +fi test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall" # POSIX no longer requires 'egrep' and 'fgrep', diff --git a/tests/help.test b/tests/help.test index dd8b3b4..d8aa96f 100755 --- a/tests/help.test +++ b/tests/help.test @@ -25,9 +25,10 @@ set -e mkdir emptydir cd emptydir -# Honour user overrides for $ACLOCAL and $AUTOMAKE. -ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'` -AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'` +# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without +# adding extra options. +ACLOCAL=$original_ACLOCAL +AUTOMAKE=$original_AUTOMAKE $ACLOCAL --version $ACLOCAL --help diff --git a/tests/help2.test b/tests/help2.test index 5212092..384507f 100755 --- a/tests/help2.test +++ b/tests/help2.test @@ -24,9 +24,10 @@ set -e mkdir cleandir cd cleandir -# Honour user overrides for $ACLOCAL and $AUTOMAKE. -ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'` -AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'` +# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without +# adding extra options. +ACLOCAL=$original_ACLOCAL +AUTOMAKE=$original_AUTOMAKE echo '[' > configure.in diff --git a/tests/help3.test b/tests/help3.test index 72399e3..d3652ea 100755 --- a/tests/help3.test +++ b/tests/help3.test @@ -24,9 +24,10 @@ set -e mkdir cleandir cd cleandir -# Honour user overrides for $ACLOCAL and $AUTOMAKE. -ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'` -AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'` +# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without +# adding extra options. +ACLOCAL=$original_ACLOCAL +AUTOMAKE=$original_AUTOMAKE cat > configure.in <<END AC_INIT([$me], [1.0]) diff --git a/tests/help4.test b/tests/help4.test index c5eb31e..ab377e6 100755 --- a/tests/help4.test +++ b/tests/help4.test @@ -25,9 +25,10 @@ set -e mkdir emptydir cd emptydir -# Honour user overrides for $ACLOCAL and $AUTOMAKE. -ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'` -AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'` +# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without +# adding extra options. +ACLOCAL=$original_ACLOCAL +AUTOMAKE=$original_AUTOMAKE escape_dots () { sed 's/\./\\./g'; } # avoid issues with `\' in backquotes apiversion_rx=`echo "$APIVERSION" | escape_dots` -- 1.7.1