]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Speed up AT_CHECK.
authorEric Blake <ebb9@byu.net>
Fri, 21 Nov 2008 00:06:22 +0000 (17:06 -0700)
committerEric Blake <ebb9@byu.net>
Fri, 21 Nov 2008 01:55:10 +0000 (18:55 -0700)
* lib/autotest/general.m4 (AT_CHECK, AT_CHECK_UNQUOTED): Expand
third and fourth arguments once.
(_AT_CHECK): Don't re-expand expected output.  Rearrange code for
fewer scans of arguments.
(AT_CHECK): Update caller.
(AT_INIT) <at_fn_filter_trace>: Drop parameter.
* tests/m4sugar.at (m4@&t@_split): Protect test with
quadrigraphs.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/autotest/general.m4
tests/m4sugar.at

index 0d0ce659e3266ff0acfcef323ee8c00d6086ed3b..b14c98dfbe45d7dcfbbf7c6e134d359daa5e16b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2008-11-20  Eric Blake  <ebb9@byu.net>
 
+       Speed up AT_CHECK.
+       * lib/autotest/general.m4 (AT_CHECK, AT_CHECK_UNQUOTED): Expand
+       third and fourth arguments once.
+       (_AT_CHECK): Don't re-expand expected output.  Rearrange code for
+       fewer scans of arguments.
+       (AT_CHECK): Update caller.
+       (AT_INIT) <at_fn_filter_trace>: Drop parameter.
+       * tests/m4sugar.at (m4@&t@_split): Protect test with
+       quadrigraphs.
+
        Fix XFAIL related to AT_CHECK.
        * lib/autotest/general.m4 (AT_CHECK, AT_CHECK_UNQUOTED): Expand
        first argument once.
index fc48c1f8c33ad528d816c078c41ea84c95384e3a..c485f69a15f6eaa76f3821f2d1260e1e0064ef89 100644 (file)
@@ -274,15 +274,14 @@ at_fn_check_newline ()
   esac
 }
 
-AS_FUNCTION_DESCRIBE([at_fn_filter_trace], [EXIT-CODE],
-[Split the contents of file "$at_stder1" into the "set -x" trace (on
-stderr) and the other lines (on file "$at_stderr").  Return the exit
-code EXIT-CODE.])
+AS_FUNCTION_DESCRIBE([at_fn_filter_trace], [],
+[Remove the lines in the file "$at_stderr" generated by "set -x" and print
+them to stderr.])
 at_fn_filter_trace ()
 {
+  mv "$at_stderr" "$at_stder1"
   grep '^ *+' "$at_stder1" >&2
   grep -v '^ *+' "$at_stder1" >"$at_stderr"
-  return $[1]
 }
 
 AS_FUNCTION_DESCRIBE([at_fn_log_failure], [FILE-LIST],
@@ -1743,7 +1742,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],[$3],[$4],[$5],[$6],1)])
+[_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,
 #                   [RUN-IF-FAIL], [RUN-IF-PASS])
@@ -1751,7 +1751,8 @@ _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_NOESCAPE],
-[_AT_CHECK(m4_expand([$1]),[$2],[$3],[$4],[$5],[$6])])
+[_AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]),
+  m4_expand([$4]), [$5], [$6])])
 
 
 # _AT_DECIDE_TRACEABLE(COMMANDS)
@@ -1878,12 +1879,10 @@ m4_define([AT_DIFF_STDOUT()],
          [at_fn_diff_devnull "$at_stdout" || at_failed=:])
 
 # _AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,
-#           [RUN-IF-FAIL], [RUN-IF-PASS], SHELL_ESCAPE_IO)
-# ---------------------------------------------------------
-# Worker for AT_CHECK & AT_CHECK_NOESCAPE.  The final SHELL-ESCAPE-IO
-# argument determines whether the STDOUT & STDERR arguments will be escaped or
-# not.
-#
+#           [RUN-IF-FAIL], [RUN-IF-PASS])
+# -------------------------------------------------
+# Worker for AT_CHECK and AT_CHECK_UNQUOTED, with COMMANDS, STDOUT, and
+# STDERR pre-expanded.
 #
 # Implementation Details
 # ----------------------
@@ -1918,26 +1917,25 @@ m4_define([_AT_CHECK],
 AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([[$1]])"])
 echo AT_LINE >"$at_check_line_file"
 
-: >"$at_stdout"
 if _AT_DECIDE_TRACEABLE([$1]); then
-  : >"$at_stder1"
-  ( $at_traceon; [$1] ) >>"$at_stdout" 2>>"$at_stder1"
-  at_fn_filter_trace $?
+  at_check_trace=$at_traceon at_check_filter=at_fn_filter_trace
 else
-  : >"$at_stderr"
-  ( :; [$1] ) >>"$at_stdout" 2>>"$at_stderr"
+  at_check_trace=: at_check_filter=:
 fi
-at_status=$?
-at_failed=false
+: >"$at_stdout"; : >"$at_stderr"
+( $at_check_trace; [$1]
+) >>"$at_stdout" 2>>"$at_stderr"
+at_status=$? at_failed=false
+$at_check_filter
 m4_ifdef([AT_DIFF_STDERR($4)], [m4_indir([AT_DIFF_STDERR($4)])],
-  [echo >>"$at_stderr"; AS_ECHO(["m4_ifval([$7],[AS_ESCAPE([$4])],[$4])"]) | \
+  [echo >>"$at_stderr"; AS_ECHO([["$4"]]) | \
   $at_diff - "$at_stderr" || at_failed=:])
 m4_ifdef([AT_DIFF_STDOUT($3)], [m4_indir([AT_DIFF_STDOUT($3)])],
-  [echo >>"$at_stdout"; AS_ECHO(["m4_ifval([$7],[AS_ESCAPE([$3])],[$3])"]) | \
+  [echo >>"$at_stdout"; AS_ECHO([["$3"]]) | \
   $at_diff - "$at_stdout" || at_failed=:])
 m4_if([$2], [ignore], [at_fn_check_skip],
   [at_fn_check_status m4_default([$2], [0])]) $at_status "$at_srcdir/AT_LINE"
-AS_IF($at_failed, [$5], [$6])
-$at_failed && at_fn_log_failure AT_capture_files
+m4_ifvaln([$5$6], [AS_IF($at_failed, [$5], [$6])])]dnl
+[$at_failed && at_fn_log_failure AT_capture_files
 $at_traceon; }
 ])# _AT_CHECK
index 708067b81dc547ce01df254b291ec11f77d5d728..e3387f62cd52a3b05b4dc4530014145548c608d3 100644 (file)
@@ -507,7 +507,7 @@ m4_split([a )}@&t@>=- b -=<@&t@{( c])
 [foo=``], [bar='']
 [foo=''], [bar=``]
 [a], [], [B], [], [c]
-[a], [)}>=-], [b], [-=<{(], [c]
+[a], [)}>=@&t@-], [b], [-@&t@=<{(], [c]
 ]])
 
 AT_CLEANUP