[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
12AT_CHECK_NOESCAPE.diff
From: |
derek |
Subject: |
12AT_CHECK_NOESCAPE.diff |
Date: |
7 Aug 2003 16:09:36 -0000 |
Here's the other patch I've been waiting four months on. This one simply adds
an AT_CHECK like macro called AT_CHECK_NOESCAPE that does not escape shell
metacharacters in its STDOUT & STDERR arguments.
----- Original Message -----
I implemented AT_CHECK_NOESCAPE slightly differently than I originally
suggested to Akim since it is less overhead. AT_CHECK simply calls
AT_CHECK_NOESCAPE with args 3 & 4 AS_ESCAPED and AT_CHECK_NOESCAPE contains
all the original functionality of AT_CHECK except for the AS_ESCAPE of args
3 & 4.
The entire autoconf test suite now passes without changes with this patch
applied and AT_CHECK_NOESCAPE does what it is supposed to in the baby CVS
autotest suite.
Index: ChangeLog
2003-04-09 Derek Price <address@hidden>
* lib/autotest/general.m4 (AT_CHECK): Move core functionality...
(AT_CHECK_NOESCAPE): ...to this new macro.
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.141
diff -u -r1.141 general.m4
--- lib/autotest/general.m4 31 Mar 2003 20:25:52 -0000 1.141
+++ lib/autotest/general.m4 8 Apr 2003 15:53:11 -0000
@@ -853,11 +853,13 @@
])
-# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR)
+# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,
+# [RUN-IF-FAIL], [RUN-IF-PASS])
# ------------------------------------------------
# Execute a test by performing given shell COMMANDS. These commands
# should normally exit with STATUS, while producing expected STDOUT and
-# STDERR contents.
+# STDERR contents. Shell metacharacters in STDOUT and STDERR are
+# _not_ processed by the shell, but are treated as string literals.
#
# STATUS, STDOUT, and STDERR are not checked if equal to `ignore'.
#
@@ -919,6 +921,16 @@
# ( $at_traceon; $1 ) >at-stdout 2>at-stder1
#
m4_define([AT_CHECK],
+[AT_CHECK_NOESCAPE([$1],[$2],AS_ESCAPE([$3]),AS_ESCAPE([$4]),[$5],[$6])])
+
+
+
+# AT_CHECK_NOESCAPE(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.
+m4_define([AT_CHECK_NOESCAPE],
[$at_traceoff
$at_verbose "AT_LINE: AS_ESCAPE([$1])"
echo AT_LINE >$at_check_line_file
@@ -933,14 +945,14 @@
ignore, [(echo stderr:; cat $at_stderr) >&5],
experr, [$at_diff experr $at_stderr >&5 || at_failed=:],
[], [$at_diff $at_devnull $at_stderr >&5 || at_failed=:],
- [echo >>$at_stderr; echo "AS_ESCAPE([$4])" | $at_diff - $at_stderr >&5
|| at_failed=:])
+ [echo >>$at_stderr; echo "[$4]" | $at_diff - $at_stderr >&5 ||
at_failed=:])
dnl Check stdout.
m4_case([$3],
stdout, [(echo stdout:; tee stdout <$at_stdout) >&5],
ignore, [(echo stdout:; cat $at_stdout) >&5],
expout, [$at_diff expout $at_stdout >&5 || at_failed=:],
[], [$at_diff $at_devnull $at_stdout >&5 || at_failed=:],
- [echo >>$at_stdout; echo "AS_ESCAPE([$3])" | $at_diff - $at_stdout >&5
|| at_failed=:])
+ [echo >>$at_stdout; echo "[$3]" | $at_diff - $at_stdout >&5 ||
at_failed=:])
dnl Check exit val. Don't `skip' if we are precisely checking $? = 77.
case $at_status in
m4_case([$2],
@@ -958,4 +970,4 @@
AS_IF($at_failed, [$5], [$6])
$at_failed && exit 1
$at_traceon
-])# AT_CHECK
+])# AT_CHECK_NOESCAPE
- 12AT_CHECK_NOESCAPE.diff,
derek <=