From: Ralf Wildenhues Date: Sun, 12 Sep 2010 07:45:34 +0000 (+0200) Subject: Document and test AT_CHECK args shell execution environment. X-Git-Tag: v2.68~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37b43561c5bdf3c028d365feef9c1712df737a89;p=thirdparty%2Fautoconf.git Document and test AT_CHECK args shell execution environment. * doc/autoconf.texi (Writing Testsuites): Document that COMMANDS is run in a subshell, but RUN-IF-FAIL and RUN-IF-PASS are not. * tests/autotest.at (AT@&t@_CHECK execution environment): New test. * NEWS: Update. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index ee0936b8..737ea6d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-09-13 Ralf Wildenhues + Document and test AT_CHECK args shell execution environment. + * doc/autoconf.texi (Writing Testsuites): Document that COMMANDS + is run in a subshell, but RUN-IF-FAIL and RUN-IF-PASS are not. + * tests/autotest.at (AT@&t@_CHECK execution environment): New + test. + * NEWS: Update. + autotest: document and test at_status semantics. * doc/autoconf.texi (Writing Testsuites): Document $at_status. * tests/autotest.at (at_status): New test. diff --git a/NEWS b/NEWS index a7f90688..43e36213 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,8 @@ GNU Autoconf NEWS - User visible changes. ** Autotest testsuites should not contain long text lines any more, and be portable even when very many test groups are used. -** The Autotest variable $at_status is documented now. +** AT_CHECK semantics with respect to the Autotest variable $at_status and + shell execution environment of the arguments are documented now. * Major changes in Autoconf 2.67 (2010-07-21) [stable] diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 94bc2f94..70c477d3 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -24180,17 +24180,17 @@ be a single shell word that expands into a single file name. @atindex{CHECK} @atindex{CHECK_UNQUOTED} @vrindex at_status -Execute a test by performing given shell @var{commands}. @var{commands} -is output as-is, so shell expansions are honored. These commands -should normally exit with @var{status}, while producing expected +Execute a test by performing given shell @var{commands} in a subshell. +@var{commands} is output as-is, so shell expansions are honored. These +commands should normally exit with @var{status}, while producing expected @var{stdout} and @var{stderr} contents. If @var{commands} exit with unexpected status 77, then the rest of the test group is skipped. If @var{commands} exit with unexpected status 99, then the test group is -immediately failed. Otherwise, if this test -fails, run shell commands @var{run-if-fail} or, if this test passes, run shell -commands @var{run-if-pass}. At the beginning of @var{run-if-fail} and -@var{run-if-pass}, the status of @var{commands} is available in the -@code{at_status} shell variable. +immediately failed. Otherwise, if this test fails, run shell commands +@var{run-if-fail} or, if this test passes, run shell commands +@var{run-if-pass}, both inside the current shell execution environment. +At the beginning of @var{run-if-fail} and @var{run-if-pass}, the status of +@var{commands} is available in the @code{at_status} shell variable. This macro must be invoked in between @code{AT_SETUP} and @code{AT_CLEANUP}. diff --git a/tests/autotest.at b/tests/autotest.at index 725da389..ab04dbe0 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -432,6 +432,25 @@ AT_CHECK([grep 'run-if-pass: 42' stdout], [], [ignore]) ]) +AT_CHECK_AT_TEST([AT@&t@_CHECK execution environment], + [dnl The first test should fail, so we enter RUN-IF-FAIL. + AT_CHECK([test "$state" != before], [], [], [], + [state=run-if-fail + AT_CHECK([:]) dnl need this so we do not bail out at this point. + ]) + dnl This should pass, so we enter RUN-IF-PASS. + AT_CHECK([test "$state" = run-if-fail], [], [], [], [], + [state=run-if-pass]) + AT_CHECK([test "$state" = run-if-pass]) + dnl However, COMMANDS are run inside a subshell, so do not change state. + AT_CHECK([state=broken; false], [], [], [], + [AT_CHECK([test "$state" = run-if-pass])]) + AT_CHECK([state=broken], [], [], [], [], + [AT_CHECK([test "$state" = run-if-pass])]) + ], + [], [], [], [], [], [], [state=before]) + + AT_CHECK_AT_TEST([unquoted output], [m4_define([backtick], [`]) a=a