Paolo Bonzini
2012-12-08 15:18:47 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".
http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=42b4918d161806fc56d15007c3129b50c1f94d12
The branch, master has been updated
via 42b4918d161806fc56d15007c3129b50c1f94d12 (commit)
from 64ad4deb5124bcc3082e97530c78ceb244af4b74 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 42b4918d161806fc56d15007c3129b50c1f94d12
Author: Paolo Bonzini <***@gnu.org>
Date: Fri Dec 7 13:21:59 2012 +0100
autotest: define AT_DATA_UNQUOTED
* lib/autotest/general.m4 (AT_DATA_UNQUOTED): New macro, paralleling
AT_DATA but not quoting the contents.
* doc/autoconf.texi (Writing Testsuites): Document it.
* tests/autotest.at (AT_DATA_UNQUOTED): Test it.
Signed-off-by: Paolo Bonzini <***@gnu.org>
-----------------------------------------------------------------------
Summary of changes:
NEWS | 5 +++++
doc/autoconf.texi | 6 ++++++
lib/autotest/general.m4 | 16 ++++++++++++++++
tests/autotest.at | 19 +++++++++++++++++++
4 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index 6d5b5e9..d0a38a3 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,11 @@ GNU Autoconf NEWS - User visible changes.
code on that platform. Solaris 2.4 has not been supported since
2003 and nowadays it's better to omit that old trick.
+- Autotest provides a new macro AT_DATA_UNQUOTED, similar to AT_DATA
+ but processing variable substitutions, command substitutions and
+ backslashes in the contents argument.
+
+
* Noteworthy changes in release 2.69 (2012-04-24) [stable]
** Autoconf now requires perl 5.6 or better (but generated configure
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 5b556da..3f0dbb4 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -25128,6 +25128,7 @@ End the current test group.
@sp 1
@defmac AT_DATA (@var{file}, @var{contents})
+@defmacx AT_DATA_UNQUOTED (@var{file}, @var{contents})
@atindex{DATA}
Initialize an input data @var{file} with given @var{contents}. Of
course, the @var{contents} have to be properly quoted between square
@@ -25135,6 +25136,11 @@ brackets to protect against included commas or spurious M4
expansion. @var{contents} must be empty or end with a newline.
@var{file} must
be a single shell word that expands into a single file name.
+
+The difference between @code{AT_DATA} and @code{AT_DATA_UNQUOTED} is
+that only the latter performs shell variable expansion (@samp{$}),
+command substitution (@samp{`}), and backslash escaping (@samp{\})
+on @var{contents}.
@end defmac
@defmac AT_CHECK (@var{commands}, @dvar{status, 0}, @ovar{stdout}, @
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 264a01a..7be2e3b 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1944,6 +1944,22 @@ at_banner_text_[]AT_banner_ordinal="AS_ESCAPE([$1])"])dnl
])# AT_BANNER
+# AT_DATA_UNQUOTED(FILE, CONTENTS)
+# -----------------------
+# Initialize an input data FILE with given CONTENTS, which should be
+# empty or end with a newline.
+# This macro is not robust to active symbols in CONTENTS *on purpose*.
+# If you don't want CONTENTS to be evaluated, quote it twice.
+# In addition, it does not quote shell variables. For example, it
+# can be used to generate data files containing a carriage return.
+_AT_DEFINE_SETUP([AT_DATA_UNQUOTED],
+[m4_if([$2], [], [: >$1],
+ [$2], [[]], [: >$1],
+[cat >$1 <<_ATEOF
+$2[]_ATEOF
+])])
+
+
# AT_DATA(FILE, CONTENTS)
# -----------------------
# Initialize an input data FILE with given CONTENTS, which should be
diff --git a/tests/autotest.at b/tests/autotest.at
index b56d3f8..fe2e3bc 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -178,6 +178,25 @@ AT_CHECK([cmp file2 file3])
## ------------------ ##
+## AT_DATA_UNQUOTED. ##
+## ------------------ ##
+
+AT_CHECK_AT_TEST([AT@&***@_DATA_UNQUOTED], [
+AT_CHECK([test -f file1], [1])
+AT_DATA([file1])
+AT_CHECK([test -f file1 && test ! -s file1])
+AT_CHECK([echo hi > file1])
+AT_DATA([file1], [[]])
+AT_CHECK([test -f file1 && test ! -s file1])
+file=file2
+AT_DATA_UNQUOTED([$file], [[$file
+]])
+AT_CHECK([echo file2 > file3])
+AT_CHECK([cmp file2 file3])
+])
+
+
+## ------------------ ##
## Empty test suite. ##
## ------------------ ##
hooks/post-receive
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".
http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=42b4918d161806fc56d15007c3129b50c1f94d12
The branch, master has been updated
via 42b4918d161806fc56d15007c3129b50c1f94d12 (commit)
from 64ad4deb5124bcc3082e97530c78ceb244af4b74 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 42b4918d161806fc56d15007c3129b50c1f94d12
Author: Paolo Bonzini <***@gnu.org>
Date: Fri Dec 7 13:21:59 2012 +0100
autotest: define AT_DATA_UNQUOTED
* lib/autotest/general.m4 (AT_DATA_UNQUOTED): New macro, paralleling
AT_DATA but not quoting the contents.
* doc/autoconf.texi (Writing Testsuites): Document it.
* tests/autotest.at (AT_DATA_UNQUOTED): Test it.
Signed-off-by: Paolo Bonzini <***@gnu.org>
-----------------------------------------------------------------------
Summary of changes:
NEWS | 5 +++++
doc/autoconf.texi | 6 ++++++
lib/autotest/general.m4 | 16 ++++++++++++++++
tests/autotest.at | 19 +++++++++++++++++++
4 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index 6d5b5e9..d0a38a3 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,11 @@ GNU Autoconf NEWS - User visible changes.
code on that platform. Solaris 2.4 has not been supported since
2003 and nowadays it's better to omit that old trick.
+- Autotest provides a new macro AT_DATA_UNQUOTED, similar to AT_DATA
+ but processing variable substitutions, command substitutions and
+ backslashes in the contents argument.
+
+
* Noteworthy changes in release 2.69 (2012-04-24) [stable]
** Autoconf now requires perl 5.6 or better (but generated configure
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 5b556da..3f0dbb4 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -25128,6 +25128,7 @@ End the current test group.
@sp 1
@defmac AT_DATA (@var{file}, @var{contents})
+@defmacx AT_DATA_UNQUOTED (@var{file}, @var{contents})
@atindex{DATA}
Initialize an input data @var{file} with given @var{contents}. Of
course, the @var{contents} have to be properly quoted between square
@@ -25135,6 +25136,11 @@ brackets to protect against included commas or spurious M4
expansion. @var{contents} must be empty or end with a newline.
@var{file} must
be a single shell word that expands into a single file name.
+
+The difference between @code{AT_DATA} and @code{AT_DATA_UNQUOTED} is
+that only the latter performs shell variable expansion (@samp{$}),
+command substitution (@samp{`}), and backslash escaping (@samp{\})
+on @var{contents}.
@end defmac
@defmac AT_CHECK (@var{commands}, @dvar{status, 0}, @ovar{stdout}, @
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 264a01a..7be2e3b 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1944,6 +1944,22 @@ at_banner_text_[]AT_banner_ordinal="AS_ESCAPE([$1])"])dnl
])# AT_BANNER
+# AT_DATA_UNQUOTED(FILE, CONTENTS)
+# -----------------------
+# Initialize an input data FILE with given CONTENTS, which should be
+# empty or end with a newline.
+# This macro is not robust to active symbols in CONTENTS *on purpose*.
+# If you don't want CONTENTS to be evaluated, quote it twice.
+# In addition, it does not quote shell variables. For example, it
+# can be used to generate data files containing a carriage return.
+_AT_DEFINE_SETUP([AT_DATA_UNQUOTED],
+[m4_if([$2], [], [: >$1],
+ [$2], [[]], [: >$1],
+[cat >$1 <<_ATEOF
+$2[]_ATEOF
+])])
+
+
# AT_DATA(FILE, CONTENTS)
# -----------------------
# Initialize an input data FILE with given CONTENTS, which should be
diff --git a/tests/autotest.at b/tests/autotest.at
index b56d3f8..fe2e3bc 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -178,6 +178,25 @@ AT_CHECK([cmp file2 file3])
## ------------------ ##
+## AT_DATA_UNQUOTED. ##
+## ------------------ ##
+
+AT_CHECK_AT_TEST([AT@&***@_DATA_UNQUOTED], [
+AT_CHECK([test -f file1], [1])
+AT_DATA([file1])
+AT_CHECK([test -f file1 && test ! -s file1])
+AT_CHECK([echo hi > file1])
+AT_DATA([file1], [[]])
+AT_CHECK([test -f file1 && test ! -s file1])
+file=file2
+AT_DATA_UNQUOTED([$file], [[$file
+]])
+AT_CHECK([echo file2 > file3])
+AT_CHECK([cmp file2 file3])
+])
+
+
+## ------------------ ##
## Empty test suite. ##
## ------------------ ##
hooks/post-receive
--
GNU Autoconf source repository
GNU Autoconf source repository