summaryrefslogtreecommitdiff
path: root/tests/torture.at
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-10-28 17:04:22 -0400
committerZack Weinberg <zackw@panix.com>2020-12-02 10:29:25 -0500
commit2a7a441b437d9a87271078877c2fc425137f9a3b (patch)
treee89ffe9ef81a4a1cca48f4fc8bab4784db9a3048 /tests/torture.at
parentc540f91d8950f170fa8c0f0b91de6f1505e12118 (diff)
downloadautoconf-2a7a441b437d9a87271078877c2fc425137f9a3b.tar.gz
Autotest: add official way to execute code before all/each test.
Currently, there isn’t any documented way for an Autotest testsuite to add custom code to be run either right before the main driver loop, or at the point of each AT_SETUP. For instance, there’s no good place to put environment variable sanitization that should apply to the entire testsuite (but isn’t universally relevant), or shell function definitions to be used by custom test macros. Autoconf’s test suite is poking shell functions directly into the PREPARE_TESTS diversion, and doing environment variable sanitization in each individual test. Both of these are obviously undesirable. This patch adds three new AT_* macros that can be used to do these things in an officially-supported way: AT_PREPARE_TESTS adds code to be run right before the main driver loop, AT_PREPARE_EACH_TEST adds code to be run at the beginning of each test, and AT_TEST_HELPER_FN defines a shell function that will be available to each test. In Autoconf’s test suite, I use AT_PREPARE_TESTS to factor out environment variable sanitization that *ought* to apply across the board, and AT_TEST_HELPER_FN for the helper function used by AT_CHECK_ENV. (This fixes the testsuite bug reported by Jannick at https://lists.gnu.org/archive/html/autoconf/2020-10/msg00052.html : CONFIG_SITE in the parent environment will no longer be visible to tests.) It would be nice to give an example of when AT_PREPARE_EACH_TEST is useful, in the documentation, but I didn’t find one in the autoconf test suite. * lib/autotest/general.m4 (AT_PREPARE_TESTS, AT_PREPARE_EACH_TEST) (AT_TEST_HELPER_FN): New macros. (AT_INIT, AT_TESTED): Emit the code to report tested programs only if it’s needed, and make sure it’s after any code added by AT_PREPARE_TESTS. * tests/local.at: Add AT_PREPARE_TESTS block that ensures $MAKE is set sensibly and $MAKEFLAGS and $CONFIG_SITE are unset. Use AT_TEST_HELPER_FN for the helper function needed by AT_CHECK_ENV. (AT_CHECK_MAKE): No need to sanitize $MAKE or $MAKEFLAGS here. * tests/base.at, tests/compile.at, tests/m4sh.at, tests/torture.at: No need to unset or neutralize $CONFIG_SITE in individual tests. * tests/autotest.at: Add tests for new macros. * doc/autoconf.texi, NEWS: Document new macros.
Diffstat (limited to 'tests/torture.at')
-rw-r--r--tests/torture.at5
1 files changed, 0 insertions, 5 deletions
diff --git a/tests/torture.at b/tests/torture.at
index dd9eef9c..acf04b94 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1463,11 +1463,6 @@ AT_CHECK([[grep '[1-9]\.[0-9]' stdout || exit 77]], [], [ignore])
# It should understand configure.ac.
AT_CHECK([[grep '[^0-9]1\.[01234][^0-9]' stdout && exit 77]], [1], [ignore])
-# Set CONFIG_SITE to a nonexistent file, so that there are
-# no worries about nonstandard values for 'prefix'.
-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`"