[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: Autotest: add official way to execute code before all/each test.
From: |
Zack Weinberg |
Subject: |
RFC: Autotest: add official way to execute code before all/each test. |
Date: |
Wed, 28 Oct 2020 17:24:07 -0400 |
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 .)
Comments requested particularly on the names and implementations of
the new macros. Also, it would be nice to have an example of when
AT_PREPARE_EACH_TEST is useful, but I didn’t find one in the autoconf
test suite.
This patch is available from the zack/autotest-new-hooks branch on savannah git.
zw
0001-Autotest-add-official-way-to-execute-code-before-all.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RFC: Autotest: add official way to execute code before all/each test.,
Zack Weinberg <=