From: Ralf Wildenhues Date: Sun, 12 Sep 2010 07:45:04 +0000 (+0200) Subject: autotest: document and test at_status semantics. X-Git-Tag: v2.68~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d85369c9bffea405dc9b238d0c07d62cf3501beb;p=thirdparty%2Fautoconf.git 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 --- diff --git a/ChangeLog b/ChangeLog index 0292caa2..ee0936b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-09-13 Ralf Wildenhues + 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 bfe55e64..a7f90688 100644 --- 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.*. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index bbbeb777..94bc2f94 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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}. diff --git a/tests/autotest.at b/tests/autotest.at index fc636e9e..725da389 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -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