[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: document $at_status for use in RUN-IF-{PASS,FAIL} of AT_CHECK
From: |
Ralf Wildenhues |
Subject: |
Re: document $at_status for use in RUN-IF-{PASS,FAIL} of AT_CHECK |
Date: |
Mon, 6 Sep 2010 08:08:55 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
* Eric Blake wrote on Mon, Aug 23, 2010 at 04:35:18PM CEST:
> On 08/20/2010 10:51 PM, Ralf Wildenhues wrote:
> >Would you accept a patch to document $at_status being usable in the
> >RUN-IF-FAIL and RUN-IF-PASS arguments of AT_CHECK (including coverage
> >of course)?
>
> Sounds good to me, unless you like my alternate idea:
[...]
> However, while those alternate heuristics will allow us to avoid
> exposing $at_status, it seems like a lot of complexity in the
> autotest/general.m4 file, compared to just documenting a fixed name
> that is available without any extra user effort.
I agree.
Proposed patch (relies on the two indexing patches for the @vrindex to
appear anywhere).
Thanks,
Ralf
autotest: document and test at_status semantics.
* doc/autoconf.texi (Writing Testsuites): Document $at_status.
* tests/autotest.at (at_status): New test.
* NEWS: Update.
diff --git a/NEWS b/NEWS
index bfe55e6..a7f9068 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 1849387..caa6309 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -24141,6 +24141,7 @@ Writing Testsuites
@ovar{stderr}, @ovar{run-if-fail}, @ovar{run-if-pass})
@atindex{CHECK}
@atindex{CHECK_UNQUOTED}
address@hidden 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
@@ -24149,7 +24150,9 @@ Writing Testsuites
@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
address@hidden, the status of @var{commands} is available in the
address@hidden 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 fc636e9..725da38 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
- Re: document $at_status for use in RUN-IF-{PASS,FAIL} of AT_CHECK,
Ralf Wildenhues <=