autoconf-patches
[Top][All Lists]
Advanced

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

Re: 2.63b autotest vs. bison testsuite


From: Eric Blake
Subject: Re: 2.63b autotest vs. bison testsuite
Date: Fri, 24 Apr 2009 14:54:21 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:

> > I'm thinking of applying this series; any problems?
> 
> The first (very minor) one that I see is that your log messages are not
> verbose enough for me to follow.  For example, this:

Addressed in the refactored series, shown below.  I'll wait a couple more hours 
for any other comments.

> 
> Does any of the changes cause the first argument of AT_CHECK_UNQUOTED to
> be treated differently now?

No.  I'm making that more clear in the manual (only the stdout/stderr arguments 
are affected, since they are the only ones taken literally in AT_CHECK.  The 
commands argument has historically been in an unquoted context).

> 
> For the manual, I'd prefer "here-document" or "here document" over
> "here-doc".

I went with "here-document" (since we already have a node by that name), and 
made it consistent throughout the manual as a separate patch.

> > +# AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
> > +#                   [RUN-IF-FAIL], [RUN-IF-PASS])
> > +# ---------------------------------------------------------
> > +# Obsolete spelling of AT_CHECK_UNQUOTED.
> > +m4_define([AT_CHECK_NOESCAPE],
> > +[m4_warn([obsolete], [use AT_CHECK_UNQUOTED instead of $0])]dnl
> > +[AT_CHECK_UNQUOTED($@)])
> 
> Bummer we're moving away from using AC_DEFUN, AU_DEFUN, and autoupdate,
> in favor of m4_* nowadays.  

AC_DEFUN won't work (this is the autotest language of autom4te, but AC_DEFUN is 
in the autoconf language).  Does anyone really use AU_DEFUN on autotest?  At 
any rate, I'm not even sure autoupdate knows how to interact with the autotest 
language.  So for this particular obsoletion, m4_define is the only method 
available.


>From 988161bf4ed340fbdc2b14715f25fe8d7f5ca99c Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 22 Apr 2009 17:14:13 -0600
Subject: [PATCH 1/4] Rename AT_CHECK_NOESCAPE to AT_CHECK_UNQUOTED.

* lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Deprecate, in favor
of new spelling...
(AT_CHECK_UNQUOTED): ...for consistency with AC_DEFINE_UNQUOTED.
* doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Document the
rename.
* NEWS: Likewise.
* tests/autotest.at (Binary output, Cleanup): Adjust tests.
* tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
Likewise.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |   14 ++++++++++++++
 NEWS                    |    3 ++-
 doc/autoconf.texi       |   12 +++++++-----
 lib/autotest/general.m4 |   16 ++++++++++++----
 tests/autotest.at       |    8 ++++----
 tests/torture.at        |    4 ++--
 6 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 93cf5f2..1307b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-04-24  Eric Blake  <address@hidden>
+
+       Rename AT_CHECK_NOESCAPE to AT_CHECK_UNQUOTED.
+       * lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Deprecate, in favor
+       of new spelling...
+       (AT_CHECK_UNQUOTED): ...for consistency with AC_DEFINE_UNQUOTED.
+       * doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Document the
+       rename.
+       * NEWS: Likewise.
+       * tests/autotest.at (Binary output, Cleanup): Adjust tests.
+       * tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
+       Likewise.
+       Reported by Ralf Wildenhues.
+
 2009-04-22  Ralf Wildenhues  <address@hidden>

        New test to ensure autom4te cache file locking works.
diff --git a/NEWS b/NEWS
index 107a10c..2831d66 100644
--- a/NEWS
+++ b/NEWS
@@ -16,7 +16,8 @@ GNU Autoconf NEWS - User visible changes.
    of AT_XFAIL_IF.  It also understands the new directives
    ignore-nolog, stdout-nolog, and stderr-nolog.

-** The autotest macro AT_CHECK_NOESCAPE is now documented.
+** The following documented autotest macros are new:
+   AT_CHECK_UNQUOTED

 ** The following documented m4sugar macros are new:
    m4_argn  m4_default_nblank  m4_default_nblank_quoted  m4_ifblank
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 15798a4..d1a77fa 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -22403,11 +22403,12 @@ Writing Testsuites

 @defmac AT_CHECK (@var{commands}, @dvar{status, 0}, @ovar{stdout}, @
   @ovar{stderr}, @ovar{run-if-fail}, @ovar{run-if-pass})
address@hidden AT_CHECK_NOESCAPE (@var{commands}, @dvar{status, 0}, 
@ovar{stdout}, @
address@hidden AT_CHECK_UNQUOTED (@var{commands}, @dvar{status, 0}, 
@ovar{stdout}, @
   @ovar{stderr}, @ovar{run-if-fail}, @ovar{run-if-pass})
 @atindex{CHECK}
address@hidden
-Execute a test by performing given shell @var{commands}.  These commands
address@hidden
+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
 @var{stdout} and @var{stderr} contents.  If @var{commands} exit with
 unexpected status 77, then the rest of the test group is skipped.  If
@@ -22433,9 +22434,10 @@ Writing Testsuites
 @var{commands} on standard out and standard error (including an empty
 parameter for no output); any differences are captured in the testsuite
 log and the test is failed.  The difference between @code{AT_CHECK} and
address@hidden is that only the latter performs shell
address@hidden is that only the latter performs shell
 expansions on comparison text given in the @var{stdout} and @var{stderr}
-arguments.
+arguments (however, there is no difference in the interpretation of
address@hidden).

 @table @samp
 @item ignore
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 2e622a5..f959a41 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -332,7 +332,7 @@ at_fn_check_skip ()
 {
   case $[1] in
     99) echo 99 > "$at_status_file"; at_failed=:
-        AS_ECHO(["$[2]: hard failure"]); exit 99;;
+       AS_ECHO(["$[2]: hard failure"]); exit 99;;
     77) echo 77 > "$at_status_file"; exit 77;;
   esac
 }
@@ -350,7 +350,7 @@ dnl $? = 77 or $? = 99.
     $[1] ) ;;
     77) echo 77 > "$at_status_file"; exit 77;;
     99) echo 99 > "$at_status_file"; at_failed=:
-        AS_ECHO(["$[3]: hard failure"]); exit 99;;
+       AS_ECHO(["$[3]: hard failure"]); exit 99;;
     *) AS_ECHO(["$[3]: exit code was $[2], expected $[1]"])
       at_failed=:;;
   esac
@@ -1904,15 +1904,23 @@ _AT_DEFINE_SETUP([AT_CHECK],
 [_AT_CHECK(m4_expand([$1]), [$2], m4_expand([AS_ESCAPE([$3])]),
   m4_expand([AS_ESCAPE([$4])]), [$5], [$6])])

-# AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
+# AT_CHECK_UNQUOTED(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
 # ---------------------------------------------------------
 # Like AT_CHECK, but do not AS_ESCAPE shell metacharacters in the STDOUT
 # and STDERR arguments before running the comparison.
-_AT_DEFINE_SETUP([AT_CHECK_NOESCAPE],
+_AT_DEFINE_SETUP([AT_CHECK_UNQUOTED],
 [_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
   m4_expand([$4]), [$5], [$6])])

+# AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
+#                   [RUN-IF-FAIL], [RUN-IF-PASS])
+# ---------------------------------------------------------
+# Obsolete spelling of AT_CHECK_UNQUOTED.
+m4_define([AT_CHECK_NOESCAPE],
+[m4_warn([obsolete], [use AT_CHECK_UNQUOTED instead of $0])]dnl
+[AT_CHECK_UNQUOTED($@)])
+

 # _AT_DECIDE_TRACEABLE(COMMANDS)
 # ------------------------------
diff --git a/tests/autotest.at b/tests/autotest.at
index 721925c..827808c 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -349,7 +349,7 @@ AT_CHECK_AT([Binary output],
     str=$str$str$str$str$str$str$str$str$str$str
     str=$str$str$str$str$str$str$str$str$str$str
     str=$str$str$str$str$str
-    AT_CHECK_NOESCAPE([echo $str], [0], [[$str]m4_newline])
+    AT_CHECK_UNQUOTED([echo $str], [0], [[$str]m4_newline])
     AT_CLEANUP
     AT_SETUP([fail: no trailing newline])
     AT_CHECK([printf short], [0], [stdout-nolog])
@@ -366,7 +366,7 @@ AT_CHECK_AT([Binary output],
     str=$str$str$str$str$str$str$str$str$str$str
     str=$str$str$str$str$str$str$str$str$str$str
     str=$str$str$str$str$str
-    AT_CHECK_NOESCAPE([echo x$str], [0], [[${str}x]m4_newline])
+    AT_CHECK_UNQUOTED([echo x$str], [0], [[${str}x]m4_newline])
     AT_CLEANUP
 ]], [], [0], [], [], [],
   [AT_CHECK([$CONFIG_SHELL ./micro-suite 4], [1], [ignore], [ignore])
@@ -376,10 +376,10 @@ AT_CHECK_AT([Binary output],

 AT_CHECK_AT_TEST([Cleanup],
   [AT_CHECK([test ! -f cleanup.success && test ! -f cleanup.failure])
-   AT_CHECK_NOESCAPE([exit $value], [ignore], [$output],
+   AT_CHECK_UNQUOTED([exit $value], [ignore], [$output],
      [], [touch cleanup.failure], [touch cleanup.success])],
   [], [], [], [],
-  [AT_KEYWORDS([AT@&address@hidden)
+  [AT_KEYWORDS([AT@&address@hidden)
     output=; export output],
   [AT_CHECK([test -d micro-suite.dir/1])
    AT_CHECK([test -f micro-suite.dir/1/cleanup.success])
diff --git a/tests/torture.at b/tests/torture.at
index 9d58e51..11cd05a 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -326,11 +326,11 @@ END
           [0], [ignore])
   # Run the same test a 2nd time to see that config.status does not recreate
   # the header (regression test)
-  AT_CHECK_NOESCAPE([./config.status "--header=$file:$file.in"],
+  AT_CHECK_UNQUOTED([./config.status "--header=$file:$file.in"],
                    [0], [config.status: creating $file
 config.status: $file is unchanged
 ])
-  AT_CHECK_NOESCAPE([grep ' & ' "$file"], [],
+  AT_CHECK_UNQUOTED([grep ' & ' "$file"], [],
 [/* $file.  Generated from $file.in by configure.  */
 ])
   AT_CHECK([$FGREP "$file" "$file"], [0], [ignore])
-- 
1.6.1.2


>From 0e22c4954d7e9b0cb0af6fe98549630bd005743a Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 24 Apr 2009 08:46:59 -0600
Subject: [PATCH 2/4] Make AT_CHECK_UNQUOTED more like AC_DEFINE_UNQUOTED.

* lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Keep older,
undocumented semantics, where unbalanced " cannot be used in the
stdout/stderr argument.
(AT_CHECK_UNQUOTED): Treat " in stdout/stderr as a literal, since
the text is used in double-quoted context.
* tests/autotest.at (unquoted output): New test.
* doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Mention which
shell expansions are handled.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |   10 ++++++++++
 doc/autoconf.texi       |   14 +++++++++-----
 lib/autotest/general.m4 |    9 +++++----
 tests/autotest.at       |    7 +++++++
 4 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1307b0c..a4c6332 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-04-24  Eric Blake  <address@hidden>

+       Make AT_CHECK_UNQUOTED more like AC_DEFINE_UNQUOTED.
+       * lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Keep older,
+       undocumented semantics, where unbalanced " cannot be used in the
+       stdout/stderr argument.
+       (AT_CHECK_UNQUOTED): Treat " in stdout/stderr as a literal, since
+       the text is used in double-quoted context.
+       * tests/autotest.at (unquoted output): New test.
+       * doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Mention which
+       shell expansions are handled.
+
        Rename AT_CHECK_NOESCAPE to AT_CHECK_UNQUOTED.
        * lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Deprecate, in favor
        of new spelling...
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index d1a77fa..b013afa 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8760,7 +8760,8 @@ Defining Symbols
 Like @code{AC_DEFINE}, but three shell expansions are
 performed---once---on @var{variable} and @var{value}: variable expansion
 (@samp{$}), command substitution (@samp{`}), and backslash escaping
-(@samp{\}).  Single and double quote characters in the value have no
+(@samp{\}), as if in an unquoted here-doc.  Single and double quote
+characters in the value have no
 special meaning.  Use this macro instead of @code{AC_DEFINE} when
 @var{variable} or @var{value} is a shell variable.  Examples:

@@ -22434,10 +22435,13 @@ Writing Testsuites
 @var{commands} on standard out and standard error (including an empty
 parameter for no output); any differences are captured in the testsuite
 log and the test is failed.  The difference between @code{AT_CHECK} and
address@hidden is that only the latter performs shell
-expansions on comparison text given in the @var{stdout} and @var{stderr}
-arguments (however, there is no difference in the interpretation of
address@hidden).
address@hidden is that only the latter performs shell variable
+expansion (@samp{$}), command substitution (@samp{`}), and backslash
+escaping (@samp{\}) on comparison text given in the @var{stdout} and
address@hidden arguments; if the text includes a trailing newline, this
+would be the same as if it were specified via an unquoted
+here-doc.  (However, there is no difference in the interpretation
+of @var{commands}).

 @table @samp
 @item ignore
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index f959a41..a16224b 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1910,16 +1910,17 @@ _AT_DEFINE_SETUP([AT_CHECK],
 # Like AT_CHECK, but do not AS_ESCAPE shell metacharacters in the STDOUT
 # and STDERR arguments before running the comparison.
 _AT_DEFINE_SETUP([AT_CHECK_UNQUOTED],
-[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
-  m4_expand([$4]), [$5], [$6])])
+[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3])), [""]),
+  AS_ESCAPE(m4_dquote(m4_expand([$4])), [""]), [$5], [$6])])

 # AT_CHECK_NOESCAPE(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
 # ---------------------------------------------------------
 # Obsolete spelling of AT_CHECK_UNQUOTED.
 m4_define([AT_CHECK_NOESCAPE],
-[m4_warn([obsolete], [use AT_CHECK_UNQUOTED instead of $0])]dnl
-[AT_CHECK_UNQUOTED($@)])
+[m4_warn([obsolete], [consider using AT_CHECK_UNQUOTED instead of $0])]dnl
+[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
+  m4_expand([$4]), [$5], [$6])])


 # _AT_DECIDE_TRACEABLE(COMMANDS)
diff --git a/tests/autotest.at b/tests/autotest.at
index 827808c..0fad78d 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -287,6 +287,13 @@ AT_CHECK_AT_TEST([errexit],
    AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore])],
   [--errexit])

+AT_CHECK_AT_TEST([unquoted output],
+  [m4_define([backtick], [`])
+   a=a
+   AT_CHECK_UNQUOTED([echo 'a"b  backtick`'], [],
+     [${a}"`echo 'b  '`\`\backtick]m4_newline)],
+  [], [], [], [], [AT_KEYWORDS([AT@&address@hidden)])
+
 AT_CHECK_AT([Logging],
   [[AT_INIT([artificial test suite])
     dnl intentionally write failing tests, to see what gets logged
-- 
1.6.1.2


>From afe845b53a956b62cb4bc0656530745a84e466b1 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 24 Apr 2009 08:50:39 -0600
Subject: [PATCH 3/4] manual: Use consistent spelling of here-document.

* doc/autoconf.texi (Defining Symbols, Programming in M4sh)
(Common Shell Constructs, Macro Names, Writing Testsuites): Fix
spelling.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog         |    6 ++++++
 doc/autoconf.texi |   14 +++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a4c6332..5d3c45c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-04-24  Eric Blake  <address@hidden>

+       manual: Use consistent spelling of here-document.
+       * doc/autoconf.texi (Defining Symbols, Programming in M4sh)
+       (Common Shell Constructs, Macro Names, Writing Testsuites): Fix
+       spelling.
+       Reported by Ralf Wildenhues.
+
        Make AT_CHECK_UNQUOTED more like AC_DEFINE_UNQUOTED.
        * lib/autotest/general.m4 (AT_CHECK_NOESCAPE): Keep older,
        undocumented semantics, where unbalanced " cannot be used in the
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index b013afa..a4bb429 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8760,7 +8760,7 @@ Defining Symbols
 Like @code{AC_DEFINE}, but three shell expansions are
 performed---once---on @var{variable} and @var{value}: variable expansion
 (@samp{$}), command substitution (@samp{`}), and backslash escaping
-(@samp{\}), as if in an unquoted here-doc.  Single and double quote
+(@samp{\}), as if in an unquoted here-document.  Single and double quote
 characters in the value have no
 special meaning.  Use this macro instead of @code{AC_DEFINE} when
 @var{variable} or @var{value} is a shell variable.  Examples:
@@ -12358,7 +12358,7 @@ Programming in M4sh

 M4sh reserves the M4 macro namespace @samp{^_AS_} for internal use, and
 the namespace @samp{^AS_} for M4sh macros.  It also reserves the shell
-and environment variable namespace @samp{^as_}, and the here-doc
+and environment variable namespace @samp{^as_}, and the here-document
 delimiter namespace @samp{^_AS[A-Z]} in the output file.  You should not
 define your own macros or output shell code that conflicts with these
 namespaces.
@@ -12440,10 +12440,10 @@ Common Shell Constructs
 needing escapes when @var{string} will be used literally within double
 quotes.  One common variant is the set of characters to protect when
 @var{string} will be used literally within back-ticks or an unquoted
-here-doc (@samp{\$`}).  Another common variant is @samp{""}, which can
+here-document (@samp{\$`}).  Another common variant is @samp{""}, which can
 be used to form a double-quoted string containing the same expansions
 that would have occurred if @var{string} were expanded in an unquoted
-here-doc; however, when using this variant, care must be taken that
+here-document; however, when using this variant, care must be taken that
 @var{string} does not use double quotes within complex variable
 expansions (such as @address@hidden "hi"address@hidden) that would be broken
 with improper escapes.
@@ -13052,7 +13052,7 @@ Macro Names
 other text; Autoconf also reserves the namespace @samp{^_AC_} for
 internal macros.  All shell variables that they use for internal
 purposes have mostly-lowercase names starting with @samp{ac_}.  Autoconf
-also uses here-doc delimiters in the namespace @samp{^_AC[A-Z]}.  During
+also uses here-document delimiters in the namespace @samp{^_AC[A-Z]}.  During
 @command{configure}, files produced by Autoconf make heavy use of the
 file system namespace @samp{^conf}.

@@ -22283,7 +22283,7 @@ Writing Testsuites
 other text; Autoconf also reserves the namespace @samp{^_AT_} for
 internal macros.  All shell variables used in the testsuite for internal
 purposes have mostly-lowercase names starting with @samp{at_}.  Autotest
-also uses here-doc delimiters in the namespace @samp{^_AT[A-Z]}, and
+also uses here-document delimiters in the namespace @samp{^_AT[A-Z]}, and
 makes use of the file system namespace @samp{^at-}.

 Since Autoconf is built on top of M4sugar (@pxref{Programming in
@@ -22440,7 +22440,7 @@ Writing Testsuites
 escaping (@samp{\}) on comparison text given in the @var{stdout} and
 @var{stderr} arguments; if the text includes a trailing newline, this
 would be the same as if it were specified via an unquoted
-here-doc.  (However, there is no difference in the interpretation
+here-document.  (However, there is no difference in the interpretation
 of @var{commands}).

 @table @samp
-- 
1.6.1.2


>From c6b8609de9902a7e53e6d777f9bc2d07f097ccd6 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 22 Apr 2009 22:06:04 -0600
Subject: [PATCH 4/4] Fix quoting of m4 macros in AT_CHECK.

* lib/autotest/general.m4 (AT_CHECK): Expand prior to adding
escapes, to avoid shell syntax errors caused by late macro
expansion.
* NEWS: Document this change.
* tests/autotest.at (Metacharacters in command from M4 expansion):
New test.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |    8 ++++++++
 NEWS                    |    3 +++
 lib/autotest/general.m4 |    4 ++--
 tests/autotest.at       |    6 ++++++
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5d3c45c..0c243ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-04-24  Eric Blake  <address@hidden>

+       Fix quoting of m4 macros in AT_CHECK.
+       * lib/autotest/general.m4 (AT_CHECK): Expand prior to adding
+       escapes, to avoid shell syntax errors caused by late macro
+       expansion.
+       * NEWS: Document this change.
+       * tests/autotest.at (Metacharacters in command from M4 expansion):
+       New test.
+
        manual: Use consistent spelling of here-document.
        * doc/autoconf.texi (Defining Symbols, Programming in M4sh)
        (Common Shell Constructs, Macro Names, Writing Testsuites): Fix
diff --git a/NEWS b/NEWS
index 2831d66..11466d6 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ GNU Autoconf NEWS - User visible changes.
 ** Ensure AT_CHECK can support commands that include a # given with
    proper m4 quoting.  For shell comments, this is a new feature; for
    non-shell comments, this fixes a regression introduced in 2.63b.
+   Additionally, AT_CHECK correctly supplies shell escapes for
+   metacharacters occurring in m4 macro expansions within the expected
+   stdout and stderr parameters.

 ** The macro AT_CHECK now understands the concept of hard failure.  If
    a test exits with an unexpected status 99, cleanup actions for the
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index a16224b..ce65397 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1901,8 +1901,8 @@ $2[]_ATEOF
 # This may cause spurious failures when the test suite is run with `-x'.
 #
 _AT_DEFINE_SETUP([AT_CHECK],
-[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([AS_ESCAPE([$3])]),
-  m4_expand([AS_ESCAPE([$4])]), [$5], [$6])])
+[_AT_CHECK(m4_expand([$1]), [$2], AS_ESCAPE(m4_dquote(m4_expand([$3]))),
+  AS_ESCAPE(m4_dquote(m4_expand([$4]))), [$5], [$6])])

 # AT_CHECK_UNQUOTED(COMMANDS, [STATUS = 0], STDOUT, STDERR,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
diff --git a/tests/autotest.at b/tests/autotest.at
index 0fad78d..d86088c 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -491,6 +491,12 @@ bar'])
 ]], [])])


+AT_CHECK_AT_TEST([Metacharacters in command from M4 expansion],
+  [m4_define([GNU], [\"`])
+   AT_CHECK([echo '\"`' [GNU] 'GNU'], 0, [GNU [G][NU] [\"`
+]], [])])
+
+
 ## -------------------------------------- ##
 ## Backslash-<newline> in test commands.  ##
 ## -------------------------------------- ##
-- 
1.6.1.2







reply via email to

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