[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fix AT_SETUP's sh-escaping
From: |
Joel E. Denny |
Subject: |
Re: fix AT_SETUP's sh-escaping |
Date: |
Thu, 26 Oct 2006 22:37:20 -0400 (EDT) |
On Thu, 26 Oct 2006, Joel E. Denny wrote:
> On Thu, 26 Oct 2006, Stepan Kasal wrote:
>
> > at_help_all="AS_ESCAPE(m4_defn([AT_help_all]))"
> I suppose I should add a test case with a macro that needs escaping after
> expansion. Expected failure for now.
> > You should also check that
> > AT_SETUP([[macro_name]])
> > really leaves `macro_name' unexpanded.
> >
> > In other words, with this
> > m4_define([macro_name], [[macro_expanded]])
> > m4_define([macro_expanded], [macro_overexpanded])
> > ...
> > AT_SETUP([macro_name])
> >
> > you should get `macro_expanded' on the output.
The following patch includes the above. The printed titles are also
checked now.
Index: ChangeLog
===================================================================
RCS file: /sources/autoconf/autoconf/ChangeLog,v
retrieving revision 1.3083
diff -p -u -r1.3083 ChangeLog
--- ChangeLog 26 Oct 2006 19:30:32 -0000 1.3083
+++ ChangeLog 27 Oct 2006 02:29:29 -0000
@@ -1,3 +1,32 @@
+2006-10-26 Joel E. Denny <address@hidden>
+ and Stepan Kasal <address@hidden>
+
+ Handle special characters in test case titles correctly.
+ * lib/autotest/general.m4 (AT_INIT): M4-quote and AS_ESCAPE AT_help_all
+ properly.
+ (AT_SETUP): M4-quote and AS_ESCAPE the title properly everywhere.
+ * tests/autotest.at (AT_CHECK_AT_TITLE): Add EXPANDED-TITLE-TO-TEST
+ argument. Extend to check titles printed by ./micro-suite and
+ ./micro-suite -l and the title in micro-suite.log.
+ (Backquote in a test title,
+ Single-quote in a test title,
+ Double-quote in a test title): Don't expect failure anymore.
+ (Backslash in a test title): Put a non-whitespace character after the
+ backslash so that Bourne shells might actually see it as an escape
+ sequence.
+ (Brackets in a test title,
+ Pound in a test title,
+ Comma in a test title,
+ Quoted Macro in a test title,
+ Macro in a test title,
+ Macro with single-quote in a test title): New tests.
+ (Macro with backquote in a test title,
+ Macro with double-quote in a test title,
+ Macro with backslash in a test title): New tests expected to fail.
+ * tests/torture.at (#define header templates): M4-quote this title in
+ AT_SETUP call so that no M4 code is commented inadvertently somewhere.
+ The visible effect was a stray [] in the testsuite output.
+
2006-10-26 Paul Eggert <address@hidden>
* tests/base.at (AC_COMPUTE_INT): Test **0** rather than 1 / 0,
Index: lib/autotest/general.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.215
diff -p -u -r1.215 general.m4
--- lib/autotest/general.m4 15 Oct 2006 01:12:02 -0000 1.215
+++ lib/autotest/general.m4 27 Oct 2006 02:29:30 -0000
@@ -279,7 +279,7 @@ at_groups_all='AT_groups_all'
# numerical order.
at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
# Description of all the test groups.
-at_help_all='AT_help_all'])])dnl
+at_help_all="AS_ESCAPE(m4_defn([AT_help_all]))"])])dnl
m4_divert_push([PARSE_ARGS])dnl
at_prev=
@@ -1176,9 +1176,9 @@ m4_append([AT_groups_all], [ ]m4_defn([A
m4_divert_push([TESTS])dnl
AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
at_setup_line='m4_defn([AT_line])'
- at_desc='$1'
+ at_desc="AS_ESCAPE([$1])"
$at_quiet $ECHO_N "m4_format([%3d: %-]m4_eval(47 - m4_qdelta([$1]))[s],
- AT_ordinal, [[$1]])[]$ECHO_C"
+ AT_ordinal, AS_ESCAPE([[$1]]))[]$ECHO_C"
m4_divert_push([TEST_SCRIPT])dnl
])
Index: tests/autotest.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/autotest.at,v
retrieving revision 1.17
diff -p -u -r1.17 autotest.at
--- tests/autotest.at 24 May 2006 03:46:00 -0000 1.17
+++ tests/autotest.at 27 Oct 2006 02:29:30 -0000
@@ -236,27 +236,62 @@ conf
## Funny characters in test names. ##
## ------------------------------- ##
-# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, [XFAIL-CONDITION])
-# ----------------------------------------------------------
+# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, EXPANDED-TITLE-TO-TEST
+# [XFAIL-CONDITION])
+# ---------------------------------------------------------------
# Create a new test named TITLE that runs an Autotest test suite
-# comprised of a trivial test named TITLE-TO-TEST. XFAIL-CONDITION
-# passes verbatim to AT_CHECK_AT.
+# comprised of a trivial test named TITLE-TO-TEST, which expands
+# to EXPANDED-TITLE-TO-TEST. XFAIL-CONDITION passes verbatim to
+# AT_CHECK_AT.
m4_define([AT_CHECK_AT_TITLE],
[AT_CHECK_AT([$1],
[[
+m4@&address@hidden([macro_name], [[macro_expanded]])
+m4@&address@hidden([macro_expanded], [[macro_overexpanded]])
+m4@&address@hidden([macro_backquote], [`])
+m4@&address@hidden([macro_single_quote], ['])
+m4@&address@hidden([macro_double_quote], ["])
+m4@&address@hidden([macro_backslash], [\\])
AT_INIT([artificial test suite])
AT_SETUP([$2])
AT_CHECK([:])
AT_CLEANUP
-]], [$3])])
+]], [$4], [], [], [],
+[AT_CHECK([[./micro-suite | sed -n "s/[^:]*: \(.*[^ \t]\)[ \t]*ok.*/\1/p"]],,
+[[$3
+]])
+AT_CHECK([[./micro-suite -l \
+ | sed -n "s/.*[0-9]\+: [^ \t]\+[ \t]\+\(.*[^ \t]\)[ \t]*/\1/p"]],,
+[[$3
+]])
+AT_CHECK([[sed -n "s/[^.]*\. \(.*\) ([^)]*): ok.*/\1/p" micro-suite.log]],,
+[[$3
+]])
+])])
m4_define([AT_CHECK_AT_TITLE_CHAR],
-[AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name], $3)])
+[AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name],
+ [A ]m4_ifval([$3], [[$3]], [[$2]])[ in my name], $4)])
-AT_CHECK_AT_TITLE_CHAR([Backquote], [`], [:])
-AT_CHECK_AT_TITLE_CHAR([Single-quote], ['], [:])
-AT_CHECK_AT_TITLE_CHAR([Double-quote], ["], [:])
-AT_CHECK_AT_TITLE_CHAR([Backslash], [\])
+AT_CHECK_AT_TITLE_CHAR([Backquote], [`])
+AT_CHECK_AT_TITLE_CHAR([Single-quote], ['])
+AT_CHECK_AT_TITLE_CHAR([Double-quote], ["])
+AT_CHECK_AT_TITLE_CHAR([Backslash], [\\])
+AT_CHECK_AT_TITLE_CHAR([Brackets], [[[]]], [[]])
+AT_CHECK_AT_TITLE_CHAR([Pound], [[#]], [#])
+AT_CHECK_AT_TITLE_CHAR([Comma], [,])
+
+AT_CHECK_AT_TITLE_CHAR([Quoted Macro], [[macro_name]],
+ [macro_name])
+AT_CHECK_AT_TITLE_CHAR([Macro], [macro_name],
+ [macro_expanded])
+AT_CHECK_AT_TITLE_CHAR([Macro with backquote], [macro_backquote],
+ [`], [:])
+AT_CHECK_AT_TITLE_CHAR([Macro with single-quote], [macro_single_quote], ['])
+AT_CHECK_AT_TITLE_CHAR([Macro with double-quote], [macro_double_quote],
+ ["], [:])
+AT_CHECK_AT_TITLE_CHAR([Macro with backslash], [macro_backslash],
+ [\\], [:])
## ----------------- ##
Index: tests/torture.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.70
diff -p -u -r1.70 torture.at
--- tests/torture.at 13 Sep 2006 04:48:24 -0000 1.70
+++ tests/torture.at 27 Oct 2006 02:29:30 -0000
@@ -319,7 +319,7 @@ AT_CLEANUP
# Use various forms of `#define' templates, and make sure there are no
# problems when a symbol is prefix of another.
-AT_SETUP([#define header templates])
+AT_SETUP([[#define header templates]])
AT_DATA([configure.ac],
[[AC_INIT
- Re: m4_quote, (continued)
- Re: fix AT_SETUP's sh-escaping, Stepan Kasal, 2006/10/25
- Re: fix AT_SETUP's sh-escaping, Paul Eggert, 2006/10/25
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Stepan Kasal, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Eric Blake, 2006/10/26
- Re: fix AT_SETUP's sh-escaping, Joel E. Denny, 2006/10/26
- Re: fix AT_SETUP's sh-escaping,
Joel E. Denny <=
- Re: fix AT_SETUP's sh-escaping, Paul Eggert, 2006/10/27