autotest: document and test at_status semantics.

* 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>
This commit is contained in:
Ralf Wildenhues 2010-09-12 09:45:04 +02:00
parent 88eeae7588
commit d85369c9bf
4 changed files with 38 additions and 1 deletions

View File

@ -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

2
NEWS
View File

@ -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.*.

View 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}.

View 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