This patch simplifies at_fn_check_prepare_trace by noting that it need not call at_fn_check_prepare_notrace. Instead we can make $at_traceon be ':' or 'set -x' instead of being empty when tracing is disabled.
A similar approach is used for other variables set by at_fn_check_prepare_trace and to conditionalize the message about disabling tracing in at_fn_check_prepare_dynamic. In addition, I changed $at_traceoff to 'set +x' throughout and eliminated the variable. 2009-07-12 Paolo Bonzini <[email protected]> * lib/autotest/general.m4 (at_fn_check_prepare_trace): Do not call at_fn_check_prepare_notrace. Use $at_check_filter_trace. (at_fn_check_prepare_dynamic): Use #at_trace_echo. (at_traceon): Initialize to ':'. (at_traceoff): Remove, use 'set -x' instead throughout. (at_check_filter_trace, at_check_filter_trace): New shell variables. Initialize them if tracing is requested. --- lib/autotest/general.m4 | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index d01dd55..1868291 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -283,13 +283,9 @@ AS_FUNCTION_DESCRIBE([at_fn_check_prepare_trace], [LINE], command.]) at_fn_check_prepare_trace () { - if test -n "$at_traceon"; then - AS_ECHO(["$[1]"]) >"$at_check_line_file" - at_check_trace=$at_traceon at_check_filter=at_fn_filter_trace - : >"$at_stdout"; : >"$at_stderr" - else - at_fn_check_prepare_notrace "$[1]" - fi + AS_ECHO(["$[1]"]) >"$at_check_line_file" + at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace + : >"$at_stdout"; : >"$at_stderr" } AS_FUNCTION_DESCRIBE([at_fn_check_prepare_dynamic], [COMMAND LINE], @@ -298,10 +294,8 @@ appropriate preparation function.]) at_fn_check_prepare_dynamic () { case "$at_traceon:$[1]" in - :*$as_nl*) - at_fn_check_prepare_notrace "$[2]" ;; *$as_nl*) - echo 'Not enabling shell tracing (command contains an embedded newline)' + $at_trace_echo 'Not enabling shell tracing (command contains an embedded newline)' at_fn_check_prepare_notrace "$[2]" ;; *) at_fn_check_prepare_trace "$[2]" ;; @@ -412,6 +406,9 @@ at_verbose=: at_quiet= # Running several jobs in parallel, 0 means as many as test groups. at_jobs=1 +at_traceon=: +at_trace_echo=: +at_check_filter_trace=: # Shall we keep the debug scripts? Must be `:' when the suite is # run by a debug script, so that the script doesn't remove itself. @@ -527,7 +524,9 @@ do ;; --trace | -x ) - at_traceon='set -x'; at_traceoff='set +x' + at_traceon='set -x' + at_trace_echo=echo + at_check_filter_trace=at_fn_filter_trace ;; [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) @@ -1863,7 +1862,7 @@ echo "# -*- compilation -*-" >> "$at_group_log" AS_ECHO(["AT_ordinal. m4_defn([AT_line]): testing $1..."]) $at_traceon m4_undivert([TEST_SCRIPT])dnl Insert the code here - $at_traceoff + set +x $at_times_p && times >"$at_times_file" ) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe read at_status <"$at_status_file" @@ -2125,7 +2124,7 @@ m4_define([AT_DIFF_STDOUT()], # with parallel jobs. m4_define([_AT_CHECK], [m4_define([AT_ingroup])]dnl -[{ $at_traceoff +[{ set +x AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([[$1]])"]) _AT_DECIDE_TRACEABLE([$1]) _AT_LINE_ESCAPED ( $at_check_trace; [$1] -- 1.6.2.5
