]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
autotest: document and test at_status semantics.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 12 Sep 2010 07:45:04 +0000 (09:45 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 13 Sep 2010 18:19:20 +0000 (20:19 +0200)
* doc/autoconf.texi (Writing Testsuites): Document $at_status.
* tests/autotest.at (at_status): New test.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
doc/autoconf.texi
tests/autotest.at

index 0292caa22719bb8409197b9bab42b9014b720acc..ee0936b8f2d1a4f34f2de1e135a1fe7a2fdf4fc5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-09-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       autotest: document and test at_status semantics.
+       * doc/autoconf.texi (Writing Testsuites): Document $at_status.
+       * tests/autotest.at (at_status): New test.
+       * NEWS: Update.
+
        doc: index entries for non-environment, non-output variables.
        * doc/autoconf.texi: Clarify the meaning of the various variable
        indices.  Merge variable index `vr' into concept index using
diff --git a/NEWS b/NEWS
index bfe55e649d82c2c21cc4c36b5d701772f9f9031e..a7f90688287dde08cec05dd71190e7e397f3aad9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +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.
+
 
 * Major changes in Autoconf 2.67 (2010-07-21) [stable]
   Released by Eric Blake, based on git versions 2.66.*.
index bbbeb777edaea9e7ed9ee8251813cd0ca9e24697..94bc2f941b7cab63207660dbd139e4391fb1fd00 100644 (file)
@@ -24179,6 +24179,7 @@ be a single shell word that expands into a single file name.
   @ovar{stderr}, @ovar{run-if-fail}, @ovar{run-if-pass})
 @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
@@ -24187,7 +24188,9 @@ 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}.
+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.
 
 This macro must be invoked in between @code{AT_SETUP} and @code{AT_CLEANUP}.
 
index fc636e9e5e33877910a9d3efcc1c56ddcb6f2987..725da389996ab20f1c891f6db0374fa1407168ea 100644 (file)
@@ -405,6 +405,33 @@ AT_CHECK_AT_TEST([errexit],
    AT_CHECK([grep "inhibited subsequent" stderr], [], [ignore])],
   [--errexit])
 
+
+AT_CHECK_AT_TEST([at_status],
+  [AT_CHECK([exit $mystatus], [$expected], [], [],
+           [AT_CHECK([echo run-if-fail: $at_status], [], [ignore])],
+           [AT_CHECK([echo run-if-pass: $at_status], [], [ignore])])
+   AT_CLEANUP
+   AT_SETUP([test with nested checks])
+   AT_CHECK([exit $mystatus], [$expected], [], [],
+           [AT_CHECK([exit $mystatus], [$expected], [], [],
+                     [AT_CHECK([echo inner run-if-fail: $at_status], [],
+                               [ignore])])])],
+  [], [], [stdout], [],
+[], [
+AT_CHECK([grep 'inner run-if-fail: 42' stdout], [], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=0 expected=0], [], [stdout])
+AT_CHECK([grep 'run-if-pass: 0' stdout], [], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=42 expected=0], [], [stdout])
+AT_CHECK([grep 'run-if-fail: 42' stdout], [], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=0 expected=42], [], [stdout])
+AT_CHECK([grep 'run-if-fail: 0' stdout], [], [ignore])
+AT_CHECK([$CONFIG_SHELL ./micro-suite -x -v 1 mystatus=42 expected=42], [], [stdout])
+AT_CHECK([grep 'run-if-pass: 42' stdout], [], [ignore])
+],
+[-v mystatus=42 expected=1
+])
+
+
 AT_CHECK_AT_TEST([unquoted output],
   [m4_define([backtick], [`])
    a=a