diff options
author | Zack Weinberg <zackw@panix.com> | 2020-11-02 11:00:38 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2020-11-02 11:00:38 -0500 |
commit | 45f1c8ba95c84a2980aa2ed3d03f1674fcc114fa (patch) | |
tree | 64ae639320a6130ed71c059176a8d578e7e7eb45 | |
parent | d6fa54586d7989365cfc135bdb3ba5f7c3585a7d (diff) | |
download | autoconf-45f1c8ba95c84a2980aa2ed3d03f1674fcc114fa.tar.gz |
testsuite: Isolate aclocal from third-party macros (#110352).
Several tests in the testsuite run a system-provided aclocal, which
will look into its $prefix/share/aclocal for third-party macros.
If those macros are buggy, aclocal may bomb out even though the test
doesn’t use them, causing the test to fail spuriously.
In all tests that need to run aclocal, create an empty directory and
give aclocal the --system-acdir option pointing at that directory.
This masks out all these potentially buggy macros. (It does *not*
mask out AM_INIT_AUTOMAKE, which aclocal will find in a different
directory.)
In all tests that run autoreconf but *don’t* need to run aclocal,
create an empty aclocal.m4 and set ACLOCAL=true in the environment.
Fixes bug #110352. Problem reported by Dagobert Michelsen.
* tests/fortran.at
* tests/tools.at
* tests/torture.at:
Set ACLOCAL=true in the environment in all tests that run
autoreconf but don’t need to run aclocal.
Set ACLOCAL="aclocal --system-acdir <empty directory>" in all
tests that do need to run aclocal.
-rw-r--r-- | tests/fortran.at | 16 | ||||
-rw-r--r-- | tests/tools.at | 35 | ||||
-rw-r--r-- | tests/torture.at | 65 |
3 files changed, 93 insertions, 23 deletions
diff --git a/tests/fortran.at b/tests/fortran.at index cf4d9fef..ed48c78e 100644 --- a/tests/fortran.at +++ b/tests/fortran.at @@ -109,7 +109,13 @@ AT_DATA([foo.f], end ]]) -AT_CHECK([env ACLOCAL=true autoreconf -vi], [], [ignore], [ignore]) +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. +AT_DATA([aclocal.m4]) +ACLOCAL=true +export ACLOCAL + +AT_CHECK([autoreconf -vi], [], [ignore], [ignore]) AT_CHECK_CONFIGURE AT_CHECK_MAKE @@ -148,7 +154,13 @@ AT_DATA([foo.f], end ]]) -AT_CHECK([env ACLOCAL=true autoreconf -vi], [], [ignore], [ignore]) +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. +AT_DATA([aclocal.m4]) +ACLOCAL=true +export ACLOCAL + +AT_CHECK([autoreconf -vi], [], [ignore], [ignore]) AT_CHECK_CONFIGURE AT_CHECK_MAKE diff --git a/tests/tools.at b/tests/tools.at index 6288de00..ba443816 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -1412,6 +1412,11 @@ AT_SETUP([autoupdating with aclocal and m4@&t@_include]) # We use aclocal. AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + mkdir m4 aclocal AT_DATA([configure.ac], [[AC_INIT(x,0) @@ -1425,10 +1430,10 @@ AC_DEFUN([AC_NEW_MACRO], [echo hi]) AC_DEFUN([AC_UNCHANGED_MACRO], [echo one]) ]]) cp m4/stuff.m4 aclocal/stuff.m4 -AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore]) +AT_CHECK([$ACLOCAL -I aclocal], [0], [ignore], [ignore]) # Checking `autoupdate'. AT_CHECK_AUTOUPDATE -AT_CHECK([aclocal -I m4], [0], [ignore], [ignore]) +AT_CHECK([$ACLOCAL -I m4], [0], [ignore], [ignore]) AT_CHECK_AUTOUPDATE AT_CLEANUP @@ -1447,6 +1452,12 @@ AT_CHECK([automake --version || exit 77], [], [stdout], [ignore]) AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore]) AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.) +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + AT_DATA([configure.ac], [[AC_INIT(GNU foo, 1.0) AM_INIT_AUTOMAKE @@ -1461,7 +1472,7 @@ AT_DATA([Makefile.am], $sleep # `aclocal.m4' should be strictly younger than its inputs # If Autoconf is too old, or the user has turned caching off, skip: -AT_CHECK([aclocal || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }], +AT_CHECK([$ACLOCAL || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }], [], [], [ignore]) AT_CHECK([test -d autom4te.cache || exit 77]) AT_CHECK([autoconf]) @@ -1472,7 +1483,7 @@ sort autom4te.cache/requests >old-requests echo newer >newer $sleep # if `configure' is regenerated, we want it to be strictly newer, # to catch the error consistently. -AT_CHECK([aclocal], [], [], [ignore]) +AT_CHECK([$ACLOCAL], [],[], [ignore]) AT_CHECK([automake --no-force --add-missing], [], [], [ignore]) AT_CHECK([autoconf]) AT_CHECK([test "`find configure -newer newer`" = "" || @@ -1563,8 +1574,10 @@ AT_CLEANUP AT_SETUP([autotools and whitespace in file names]) -# We use aclocal. -AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. +ACLOCAL=true +export ACLOCAL x= export x @@ -1605,8 +1618,9 @@ END AT_CHECK_AUTOCONF([--include="$dir" -o "$file" "$file.ac"]) AT_CHECK([autoscan -B "$dir"], [], [], [ignore]) AT_CHECK([autoscan --force -I "$dir"], [], [], [ignore]) - # autoreconf requires a sane input file name. Also, disable aclocal. + # autoreconf requires a sane input file name. mv -f "$file.ac" configure.ac + # Since aclocal is disabled, provide a stub aclocal.m4. AT_DATA([aclocal.m4]) AT_CHECK([autoreconf -B "$dir"]) AT_CHECK([autoreconf --force -I "$dir"]) @@ -1630,6 +1644,11 @@ AT_SETUP([autotools and relative TMPDIR]) # We use aclocal. AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + mkdir _tmp TMPDIR=_tmp export TMPDIR @@ -1647,7 +1666,7 @@ AT_DATA([m4/foo.m4], [AC_DEFINE([HAVE_MACROS], 1, [Define if you have macros.])]) ]]) -AT_CHECK([aclocal -I m4]) +AT_CHECK([$ACLOCAL -I m4]) AT_CHECK_AUTOHEADER([], [HAVE_MACROS]) AT_CHECK_AUTOCONF AT_CHECK_CONFIGURE diff --git a/tests/torture.at b/tests/torture.at index 6ae6bfdf..76cddc65 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -1468,6 +1468,11 @@ AT_CHECK([[grep '[^0-9]1\.[01234][^0-9]' stdout && exit 77]], [1], [ignore]) CONFIG_SITE=no-such-file export CONFIG_SITE +# Prevent aclocal from reading third-party macros, in case they are buggy. +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + # The contents of `inner/', and `inner/innermost/'. AS_MKDIR_P([inner/innermost]) @@ -1504,9 +1509,7 @@ AC_CONFIG_SUBDIRS([inner]) AC_OUTPUT ]]) -# If there are improperly quoted AC_DEFUN installed in share/aclocal, -# they trigger warnings from aclocal 1.8, so ignore stderr. -AT_CHECK([autoreconf], [], [], [ignore]) +AT_CHECK([autoreconf]) AT_CHECK([test -f inner/configure]) # Running the outer configure recursively should provide the innermost @@ -1589,6 +1592,11 @@ AT_KEYWORDS(autoreconf) # We use aclocal (via autoreconf). AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + # The contents of `.' AT_DATA([install-sh], []) AT_DATA([configure.ac], @@ -1629,9 +1637,7 @@ AC_ARG_VAR([INNER2], [an inner2 variable]) AC_OUTPUT ]]) -AT_CHECK([autoreconf -Wall -v], [0], [ignore], [stderr]) -# We should not warn about nonliteral argument to AC_CONFIG_SUBDIRS here. -AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [1]) +AT_CHECK([autoreconf -Wall], [0], [ignore]) AT_CHECK([test -f inner/configure]) AT_CHECK([test -f inner/innermost/configure]) AT_CHECK([test -f inner/innermost/config.hin]) @@ -1725,6 +1731,11 @@ AT_KEYWORDS([autoreconf]) # We use aclocal (via autoreconf). AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + AT_DATA([install-sh], []) AT_DATA([configure.ac], [[AC_INIT(GNU Outer, 1.0) @@ -1744,11 +1755,12 @@ exit 0 ]]) chmod +x inner/configure -AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore]) +AT_CHECK([autoreconf -Wall], 0, [ignore]) # Running the outer configure recursively should provide the innermost # help strings. -AT_CHECK([./configure $configure_options --help=recursive | grep "folks"], 0, [ignore]) +AT_CHECK([./configure $configure_options --help=recursive | grep "folks"], + [0], [ignore]) # Running the outer configure should trigger the inner. AT_CHECK([./configure $configure_options], 0, [ignore]) @@ -1777,10 +1789,11 @@ AC_CONFIG_SUBDIRS([$my_subdirs]) AC_OUTPUT ]]) -# Hand-written aclocal.m4, so we don't invoke `aclocal -Werror' which -# could barf over warnings in third-party macro files, or fail over -# warnings with older aclocal which didn't yet understand -W*. +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. AT_DATA([aclocal.m4]) +ACLOCAL=true +export ACLOCAL AS_MKDIR_P([foo]) @@ -1822,6 +1835,12 @@ AC_CONFIG_SUBDIRS() AC_OUTPUT ]]) +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. +AT_DATA([aclocal.m4]) +ACLOCAL=true +export ACLOCAL + # autoreconf should have no complaints, and the generated configure # script should run fine with or without --no-recursion. AT_CHECK([autoreconf -Werror], [0], [ignore]) @@ -1837,8 +1856,10 @@ AT_CLEANUP AT_SETUP([Empty directory]) AT_KEYWORDS([autoreconf]) -# We use aclocal (via autoreconf). -AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. +ACLOCAL=true +export ACLOCAL # The test group directory is not necessarily _empty_, but it does not contain # files meaningful to `autoreconf'. @@ -1862,6 +1883,12 @@ AT_KEYWORDS([autoreconf]) AT_CHECK([automake --version || exit 77], [], [stdout], [ignore]) AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.) +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + AT_DATA([configure.ac], [[AC_INIT(GNU foo, 1.0) AM_INIT_AUTOMAKE @@ -1894,6 +1921,12 @@ AT_KEYWORDS([autoreconf]) # We use aclocal and automake via autoreconf. AT_CHECK([automake --version || exit 77], [], [ignore], [ignore]) +# Prevent aclocal from reading third-party macros, in case they are buggy. +# (AM_INIT_AUTOMAKE will still be available via the default --automake-acdir.) +mkdir empty +ACLOCAL="aclocal --system-acdir=`cd empty && pwd`" +export ACLOCAL + AT_DATA([configure.ac], [[AC_INIT(GNU foo, 1.0) AM_INIT_AUTOMAKE @@ -1934,6 +1967,12 @@ AT_CLEANUP AT_SETUP([Missing auxiliary files]) AT_KEYWORDS([autoreconf]) +# Prevent autoreconf from running aclocal, which might not exist, +# or could barf over warnings in third-party macro files. +AT_DATA([aclocal.m4]) +ACLOCAL=true +export ACLOCAL + AT_DATA([configure.ac], [[AC_INIT([GNU foo], [1.0]) AC_CONFIG_AUX_DIR([build-aux]) |