]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Document and test AT_CHECK args shell execution environment.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 12 Sep 2010 07:45:34 +0000 (09:45 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 13 Sep 2010 18:19:51 +0000 (20:19 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
doc/autoconf.texi
tests/autotest.at

index ee0936b8f2d1a4f34f2de1e135a1fe7a2fdf4fc5..737ea6d0b8b0c23a17882faab74cdf0329c060a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-09-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       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 a7f90688287dde08cec05dd71190e7e397f3aad9..43e36213a3a08d41cf0892972df87c8b86265d00 100644 (file)
--- 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]
index 94bc2f941b7cab63207660dbd139e4391fb1fd00..70c477d36d50d295c2daca9786438f68fac0a102 100644 (file)
@@ -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}.
 
index 725da389996ab20f1c891f6db0374fa1407168ea..ab04dbe0b03c2be23a136537abd8c6386cb34c41 100644 (file)
@@ -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