]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Document and test AT_BANNER.
authorEric Blake <ebb9@byu.net>
Fri, 19 Oct 2007 11:33:55 +0000 (05:33 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 19 Oct 2007 11:35:59 +0000 (05:35 -0600)
* doc/autoconf.texi (Writing Testsuites): Document AT_BANNER.
* tests/autotest.at (AT_CHECK_EGREP): Share between tests.
(AT_CHECK_BANNERS): New test.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
tests/autotest.at

index 5c16c31eac19e480e387f54e9e9df62049816833..1509c2edb2550a51e9aafbf67aaf05b2c964fa90 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-10-19  Eric Blake  <ebb9@byu.net>
 
+       Document and test AT_BANNER.
+       * doc/autoconf.texi (Writing Testsuites): Document AT_BANNER.
+       * tests/autotest.at (AT_CHECK_EGREP): Share between tests.
+       (AT_CHECK_BANNERS): New test.
+
        Doc touchups.
        * doc/autoconf.texi (Text processing Macros) <m4_strip>
        <m4_text_wrap>: Clarify and fix typos.
index 324e94052d391598f9a04cfaabff6de33851ad29..75b286578dbe13032ee701ead89e9b43179e4b1c 100644 (file)
@@ -19880,7 +19880,8 @@ for tests.  Each such included file, or the remainder of
 @file{testsuite.at} if include files are not used, contain a sequence of
 test groups.  Each test group begins with a call to @code{AT_SETUP},
 then an arbitrary number of shell commands or calls to @code{AT_CHECK},
-and then completes with a call to @code{AT_CLEANUP}.
+and then completes with a call to @code{AT_CLEANUP}.  Multiple test
+groups can be categorized by a call to @code{AT_BANNER}.
 
 @defmac AT_INIT (@ovar{name})
 @atindex{INIT}
@@ -19920,6 +19921,15 @@ diagnostics.
 
 @sp 1
 
+@defmac AT_BANNER (@var{test-category-name})
+@atindex{BANNER}
+This macro identifies the start of a category of related test groups.
+When the resulting @file{testsuite} is invoked with more than one test
+group to run, its output will include a banner containing
+@var{test-category-name} prior to any tests run from that category.  The
+banner should be no more than about 40 or 50 characters.
+@end defmac
+
 @defmac AT_SETUP (@var{test-group-name})
 @atindex{SETUP}
 This macro starts a group of related tests, all to be executed in the
index e3a466240428589fa5d0240c7067446e2999b7d3..19e60b1207836d2f41f507f35703c439147e3d8c 100644 (file)
@@ -71,7 +71,17 @@ m4_pattern_allow([^AT_])
 # AT_NO_CMDSUBST
 # --------------
 m4_define([AT_NO_CMDSUBST],
-[if (eval 'foo=$(echo bar) && test "$foo" = bar') >/dev/null 2>&1; then false; else :; fi])
+[if (eval 'foo=$(echo bar) && test "$foo" = bar') >/dev/null 2>&1; then ]dnl
+[false; else :; fi])
+
+# AT_CHECK_EGREP(PATTERN, STATUS, COUNT)
+# --------------------------------------
+# Run grep -E, counting how many times PATTERN occurs in the file 'stdout',
+# and expecting exit STATUS and output COUNT.
+m4_define([AT_CHECK_EGREP],
+[AT_CHECK([$EGREP -c '$1' stdout], [$2], [$3
+], [ignore])
+])
 
 
 ## ------------------ ##
@@ -370,6 +380,60 @@ AT_CHECK([(cd micro-suite.dir/1 && ./run MY_VAR='one space')],
 ])
 
 
+## -------- ##
+## Banners. ##
+## -------- ##
+AT_SETUP([Banners])
+AT_KEYWORDS([autotest])
+
+AT_DATA([b.at],
+[[m4_define([AT_PACKAGE_STRING],[b])
+m4_define([AT_PACKAGE_BUGREPORT],[devnull])
+AT_INIT
+AT_SETUP(zero)# 1
+AT_CHECK(:)
+AT_CLEANUP
+
+AT_BANNER([first])
+AT_SETUP(one a)# 2
+AT_CHECK(:)
+AT_CLEANUP
+AT_SETUP(one b)# 3
+AT_CHECK(:)
+AT_CLEANUP
+
+AT_BANNER([second])
+AT_SETUP(two a)# 4
+AT_CHECK(:)
+AT_CLEANUP
+AT_SETUP(two b)# 5
+AT_CHECK(:)
+AT_CLEANUP
+]])
+AT_CHECK_AUTOM4TE([--language=autotest -o b b.at])
+
+# AT_CHECK_BANNERS(TESTSUITE-OPTIONS, PATTERN1, COUNT1, PATTERN2, COUNT2)
+m4_define([AT_CHECK_BANNERS],
+[AT_CHECK([./b $1], [], [stdout])
+AT_CHECK_EGREP([$2], m4_if([$3], [0], [1], [0]), [$3])
+AT_CHECK_EGREP([$4], m4_if([$5], [0], [1], [0]), [$5])
+])
+
+AT_CHECK_BANNERS([],           [first], [1], [second], [1])
+AT_CHECK_BANNERS([-k zero],    [first], [0], [second], [0])
+AT_CHECK_BANNERS([1],          [first], [0], [second], [0])
+AT_CHECK_BANNERS([-2],         [first], [1], [second], [0])
+AT_CHECK_BANNERS([-3],         [first], [1], [second], [0])
+AT_CHECK_BANNERS([-k one],     [first], [1], [second], [0])
+AT_CHECK_BANNERS([3-4],                [first], [1], [second], [1])
+AT_CHECK_BANNERS([3-],         [first], [1], [second], [1])
+AT_CHECK_BANNERS([-k a],       [first], [1], [second], [1])
+AT_CHECK_BANNERS([4],          [first], [0], [second], [0])
+AT_CHECK_BANNERS([4-],         [first], [0], [second], [1])
+AT_CHECK_BANNERS([-k two],     [first], [0], [second], [1])
+AT_CLEANUP
+
+
 ## --------- ##
 ## Keywords. ##
 ## --------- ##
@@ -401,12 +465,6 @@ AT_CHECK_AUTOM4TE([--language=autotest -o k k.at])
 dnl check that AT_KEYWORDS does not duplicate words
 AT_CHECK([grep 'key1.*key1' k], [1])
 
-# AT_CHECK_EGREP(PATTERN, STATUS, COUNT)
-m4_define([AT_CHECK_EGREP],
-[AT_CHECK([$EGREP -c '$1' stdout], $2, [$3
-], ignore)
-])
-
 # AT_CHECK_KEYS(TESTSUITE-OPTIONS, PATTERN1, COUNT1, PATTERN2, COUNT2)
 m4_define([AT_CHECK_KEYS],
 [AT_CHECK([./k $1], 0, [stdout])