]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
use shell functions to speed up autotest and produce slimmer testsuites
authorPaolo Bonzini <bonzini@gnu.org>
Thu, 4 Oct 2007 16:53:10 +0000 (18:53 +0200)
committerPaolo Bonzini <bonzini@gnu.org>
Thu, 4 Oct 2007 19:49:16 +0000 (21:49 +0200)
2007-10-04  Paolo Bonzini  <bonzini@gnu.org>

* general.m4 (AT_INIT): Add at_check_newline function.
(_AT_DECIDE_TRACEABLE): Include at_traceon test, use shell function.
(_AT_CHECK): Don't use at_trace_this.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
ChangeLog
lib/autotest/general.m4

index 5a37f4cb12648b58c710ec8cec171a02e7c66a45..925c10099ddc04ba5e2c812fa43ff90913874dc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        useless expansions inside definition.
        * tests/m4sugar.at (m4@&t@_split): Add tests.
 
+2007-10-04  Paolo Bonzini  <bonzini@gnu.org>
+
+       * general.m4 (AT_INIT): Add at_check_newline function.
+       (_AT_DECIDE_TRACEABLE): Include at_traceon test, use shell function.
+       (_AT_CHECK): Don't use at_trace_this.
+
 2007-10-04  Paolo Bonzini  <bonzini@gnu.org>
 
        Fix previous commit.
index dfd098c75ad78c2bcacf34b834c6935a43e525b0..31038a1acdb0fbea4302647aff7e917bb62a2914 100644 (file)
@@ -212,6 +212,19 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # How were we run?
 at_cli_args="$[@]"
 
+#######################
+### Shell functions ###
+#######################
+
+at_check_newline ()
+{
+  case "$[1]" in
+ *'
+'*) echo 'Not enabling shell tracing (command contains an embedded newline)' ; return 1 ;;
+ *) return 0 ;;
+  esac
+}
+
 # Load the config file.
 for at_file in atconfig atlocal
 do
@@ -1337,9 +1350,9 @@ m4_define([AT_CHECK_NOESCAPE],
 # _AT_DECIDE_TRACEABLE(COMMANDS)
 # ------------------------------
 # Worker for for _AT_CHECK that expands to shell code.  If COMMANDS are safe to
-# trace with `set -x', the shell code will set `at_trace_this=yes'.  Otherwise,
+# trace with `set -x', the shell code will evaluate to true.  Otherwise,
 # the shell code will print a message stating an aspect of COMMANDS that makes
-# tracing them unsafe.
+# tracing them unsafe, and evaluate to false.
 #
 # Tracing COMMANDS is not safe if they contain a command that spans multiple
 # lines.  When the test suite user passes `-x' or `--trace', the test suite
@@ -1427,16 +1440,12 @@ m4_pushdef([at_reason],
 ))dnl
 dnl
 m4_ifval(m4_defn([at_reason]),
-[echo 'Not enabling shell tracing (command contains ]m4_defn([at_reason])[)'],
-[m4_bmatch([$1], [\$],
-dnl COMMANDS may contain parameter expansions; expand them at runtime.
-[case "AS_ESCAPE([$1], [`\"])" in
- *'
-'*) echo 'Not enabling shell tracing (command contains an embedded newline)' ;;
- *) at_trace_this=yes ;;
-    esac],
+[{ echo 'Not enabling shell tracing (command contains ]m4_defn([at_reason])[)'; false; }],
+[m4_if(m4_index([$1], [$]), [-1],
 dnl We know at build time that tracing COMMANDS is always safe.
-[at_trace_this=yes])])[]dnl
+[test -n "$at_traceon"],
+dnl COMMANDS may contain parameter expansions; expand them at runtime.
+[test -n "$at_traceon" && at_check_newline "AS_ESCAPE([$1], [`\"])"])])[]dnl
 m4_popdef([at_lf])[]dnl
 m4_popdef([at_reason])])
 
@@ -1479,12 +1488,7 @@ m4_define([_AT_CHECK],
 AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([$1])"])
 echo AT_LINE >"$at_check_line_file"
 
-at_trace_this=
-if test -n "$at_traceon"; then
-    _AT_DECIDE_TRACEABLE([$1])
-fi
-
-if test -n "$at_trace_this"; then
+if _AT_DECIDE_TRACEABLE([$1]); then
     ( $at_traceon; $1 ) >"$at_stdout" 2>"$at_stder1"
     at_status=$?
     grep '^ *+' "$at_stder1" >&2