autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AT Macro to Log a File on Failure


From: Noah Misch
Subject: Re: AT Macro to Log a File on Failure
Date: Thu, 30 Dec 2004 00:09:03 -0800
User-agent: Mutt/1.5.6i

On Wed, Dec 29, 2004 at 07:15:05PM +0100, Alexandre Duret-Lutz wrote:
> >>> "Noah" == Noah Misch <address@hidden> writes:
>  Noah> +If the current test group fails, log the contents of @var{file}.  M4
>  Noah> +expands macros in @var{file}, and the shell expands the result within
>  Noah> +double quotes to craft the name of the file to log.  Several identical
>  Noah> +calls within one test group have no additional effect.

> The rest of the patch looks good to me, but I'd suggest you omit
> (or reword) the second sentence in this description.  When I
> first read it I though that the contents of the `file' file
> would be processed by M4!  IMHO we do not need document
> arguments that are processed with M4, because that is the rule.

Yes, that wording was bad.  Let us just delete it.  Thanks.

Updated patch:

2004-12-30  Noah Misch  <address@hidden>

        * lib/autotest/general.m4 (AT_CAPTURE_FILE): New macro.
        (AT_SETUP): Clear AT_capture_files.
        (_AT_CHECK): On failure, log each of AT_capture_files.  Fix comment.
        (AT_KEYWORDS): Fix comment typo.
        * tests/autotest.at (AT_CHECK_AT): Use AT_CAPTURE_FILE.
        * tests/local.at (AT_CHECK_CONFIGURE): Use AT_CAPTURE_FILE.
        * doc/autoconf.texi (Writing testsuite.at): Document AT_CAPTURE_FILE.

diff -urp -X dontdiff ac-clean/doc/autoconf.texi ac-atcf2/doc/autoconf.texi
--- ac-clean/doc/autoconf.texi  2004-12-23 20:43:15.000000000 -0500
+++ ac-atcf2/doc/autoconf.texi  2004-12-30 03:01:54.993936319 -0500
@@ -15460,6 +15460,12 @@ other words, don't fear registering seve
 test group.
 @end defmac
 
address@hidden AT_CAPTURE_FILE (@var{file})
address@hidden
+If the current test group fails, log the contents of @var{file}.
+Several identical calls within one test group have no additional effect.
address@hidden defmac
+
 @defmac AT_XFAIL_IF (@var{shell-condition})
 @atindex{XFAIL_IF}
 Determine whether the test is expected to fail because it is a known
diff -urp -X dontdiff ac-clean/lib/autotest/general.m4 
ac-atcf2/lib/autotest/general.m4
--- ac-clean/lib/autotest/general.m4    2004-12-23 20:43:15.000000000 -0500
+++ ac-atcf2/lib/autotest/general.m4    2004-12-30 02:57:27.888610283 -0500
@@ -1040,6 +1040,7 @@ m4_define([AT_TESTED],
 # The group is testing what DESCRIPTION says.
 m4_define([AT_SETUP],
 [m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])])
+m4_ifdef([AT_capture_files], [m4_undefine([AT_capture_files])])
 m4_define([AT_line], AT_LINE)
 m4_define([AT_xfail], [at_xfail=no])
 m4_define([AT_description], [$1])
@@ -1071,13 +1072,21 @@ m4_case([$1],
       $1 && at_xfail=yes])])])
 
 
-# AT_KEYWORDS(KEYOWRDS)
+# AT_KEYWORDS(KEYWORDS)
 # ---------------------
 # Declare a list of keywords associated to the current test group.
 m4_define([AT_KEYWORDS],
 [m4_append_uniq([AT_keywords], [$1], [ ])])
 
 
+# AT_CAPTURE_FILE(FILE)
+# ---------------------
+# If the current test group does not behave as expected, save the contents of
+# FILE in the test suite log.
+m4_define([AT_CAPTURE_FILE],
+[m4_append_uniq([AT_capture_files], ["$1"], [ ])])
+
+
 # AT_CLEANUP
 # ----------
 # Complete a group of related tests.
@@ -1378,7 +1387,10 @@ m4_case([$2],
       at_failed=:;;])
 esac
 AS_IF($at_failed, [$5
+  m4_ifdef([AT_capture_files],
+    [for file in AT_capture_files
+     do echo "$file:"; sed 's/^/> /' "$file"; done])
   echo 1 > "$at_status_file"
   exit 1], [$6])
 $at_traceon
-])# AT_CHECK_NOESCAPE
+])# _AT_CHECK
diff -urp -X dontdiff ac-clean/tests/autotest.at ac-atcf2/tests/autotest.at
--- ac-clean/tests/autotest.at  2004-12-20 04:55:01.000000000 -0500
+++ ac-atcf2/tests/autotest.at  2004-12-30 02:57:27.889610655 -0500
@@ -30,6 +30,7 @@ m4_define([AT_CHECK_AT],
 [
 AT_SETUP([$1])
 AT_KEYWORDS([autotest])
+AT_CAPTURE_FILE([micro-suite.log])
 AT_XFAIL_IF([$3])
 
 AT_DATA([package.m4],[[
diff -urp -X dontdiff ac-clean/tests/local.at ac-atcf2/tests/local.at
--- ac-clean/tests/local.at     2004-12-12 14:43:29.000000000 -0500
+++ ac-atcf2/tests/local.at     2004-12-30 02:57:27.890611027 -0500
@@ -258,11 +258,10 @@ m4_define([AT_CHECK_AUTOHEADER],
 # `abs_top_srcdir' is needed so that `./configure' finds install-sh.
 # Using --srcdir is more expensive.
 m4_define([AT_CHECK_CONFIGURE],
-[AT_CHECK([top_srcdir=$abs_top_srcdir ./configure $1],
+[AT_CAPTURE_FILE([config.log])[]dnl
+ AT_CHECK([top_srcdir=$abs_top_srcdir ./configure $1],
          [$2],
-         m4_default([$3], [ignore]), [$4],
-         [{ echo "$srcdir/AT_LINE: config.log"; sed 's/^/> /' config.log; } 
>>$at_group_log ])
-])
+         m4_default([$3], [ignore]), [$4])])
 
 
 # AT_CHECK_ENV




reply via email to

[Prev in Thread] Current Thread [Next in Thread]