From 877876da7c24858695b674fa7f4946197969c151 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 13 Jul 2009 13:39:25 +0200 Subject: [PATCH] revert previous push --- NEWS | 3 -- bin/Makefile.am | 1 - bin/autom4te.in | 2 +- configure.ac | 31 --------------- doc/autoconf.texi | 38 ------------------- lib/autotest/general.m4 | 83 +++++++++++------------------------------ m4/m4.m4 | 11 ------ tests/atlocal.in | 27 ++++++++++---- tests/autotest.at | 59 +---------------------------- tests/local.at | 4 +- 10 files changed, 45 insertions(+), 214 deletions(-) diff --git a/NEWS b/NEWS index 873fcde6..93a09c9e 100644 --- a/NEWS +++ b/NEWS @@ -75,9 +75,6 @@ GNU Autoconf NEWS - User visible changes. ** Autotest testsuites do not attempt to write startup error messages to the log file before that is opened (regression introduced in 2.63). -** The following Autotest macros are new: - AT_SKIP_IF AT_FAIL_IF - ** Configure scripts now use shell functions. This feature leads to smaller configure files and faster execution. diff --git a/bin/Makefile.am b/bin/Makefile.am index da65b85f..ba88ab01 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -46,7 +46,6 @@ edit = sed \ -e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \ -e 's|@M4[@]|$(M4)|g' \ -e 's|@M4_DEBUGFILE[@]|$(M4_DEBUGFILE)|g' \ - -e 's|@M4_GNU[@]|$(M4_GNU)|g' \ -e 's|@AWK[@]|$(AWK)|g' \ -e 's|@RELEASE_YEAR[@]|'$(RELEASE_YEAR)'|g' \ -e 's|@VERSION[@]|$(VERSION)|g' \ diff --git a/bin/autom4te.in b/bin/autom4te.in index 1baf507f..cf425bb4 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -463,7 +463,7 @@ sub handle_m4 ($@) # # We don't output directly to the cache files, to avoid problems # when we are interrupted (that leaves corrupted files). - xsystem ("$m4 @M4_GNU@" + xsystem ("$m4" . join (' --include=', '', map { shell_quote ($_) } @include) . ' --debug=aflq' . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '') diff --git a/configure.ac b/configure.ac index d9095289..a5fcad0a 100644 --- a/configure.ac +++ b/configure.ac @@ -68,37 +68,6 @@ fi ]) AC_SUBST([ac_cv_sh_n_works]) -AC_MSG_CHECKING([for characters that cannot appear in file names]) -AC_CACHE_VAL( [ac_cv_unsupported_fs_chars], -[ac_cv_unsupported_fs_chars= -for c in '\\' '"' '<' '>' '*' '?' '|' -do - touch "t${c}t" 2>/dev/null - test -f "t${c}t" && rm -f "t${c}t" && continue - # $c cannot be used in a file name. - ac_cv_unsupported_fs_chars=$ac_cv_unsupported_fs_chars$c -done -]) -if test -n "$ac_cv_unsupported_fs_chars"; then - AC_MSG_RESULT([$ac_cv_unsupported_fs_chars]) -else - AC_MSG_RESULT([none]) -fi - -AC_SUBST([ac_cv_unsupported_fs_chars]) - -AC_CACHE_CHECK([whether directories can have trailing spaces], - [ac_cv_dir_trailing_space], -[rm -rf 'tdir ' && mkdir 'tdir ' && touch 'tdir /tfile' 2>/dev/null -a=$? -rm -rf 'tdir ' -case $a$? in #( - 00) ac_cv_dir_trailing_space=yes ;; #( - *) ac_cv_dir_trailing_space=no ;; -esac -]) -AC_SUBST([ac_cv_dir_trailing_space]) - # Initialize the test suite. AC_CONFIG_TESTDIR([tests]) AC_CONFIG_FILES([tests/Makefile tests/atlocal]) diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 67728274..3528f532 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -22653,44 +22653,6 @@ If the current test group fails, log the contents of @var{file}. Several identical calls within one test group have no additional effect. @end defmac -@defmac AT_FAIL_IF (@var{shell-condition}) -@atindex{FAIL_IF} -Make the test group fail, skipping the rest of its execution if -@var{shell-condition} is true. @var{shell-condition} is a shell expression -such as a @code{test} command. Tests before @command{AT_FAIL_IF} -will be executed and may still cause the test group to be skipped. -You can instantiate this macro many times from within the same test group. - -You should use this macro only for very simple failure conditions. If the -@var{shell-condition} could emit any kind of output you should instead -use @command{AT_CHECK} like -@example -AT_CHECK([@var{shell-condition}] || exit 99) -@end example -@noindent -so that such output is properly recorded in the @file{testsuite.log} -file. -@end defmac - -@defmac AT_SKIP_IF (@var{shell-condition}) -@atindex{SKIP_IF} -Determine whether the test should be skipped because it requires -features that are unsupported on the machine under test. -@var{shell-condition} is a shell expression such as a @code{test} -command. Tests before @command{AT_SKIP_IF} will be executed -and may still cause the test group to fail. You can instantiate this -macro many times from within the same test group. - -You should use this macro only for very simple skip conditions. If the -@var{shell-condition} could emit any kind of output you should instead -use @command{AT_CHECK} like -@example -AT_CHECK([@var{shell-condition}] || exit 77) -@end example -so that such output is properly recorded in the @file{testsuite.log} -file. -@end defmac - @defmac AT_XFAIL_IF (@var{shell-condition}) @atindex{XFAIL_IF} Determine whether the test is expected to fail because it is a known diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index d7370a92..a032462b 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -168,11 +168,6 @@ m4_define([AT_LINE], m4_bregexp(/__file__, [/\([^/]*\)$], [[\1]]))])])dnl m4_defn([_AT_LINE_base]):__line__]) -# _AT_LINE_ESCAPED -# ---------------- -# Same as AT_LINE, but already escaped for the shell. -m4_define([_AT_LINE_ESCAPED], ["AS_ESCAPE(m4_dquote(AT_LINE))"]) - # _AT_NORMALIZE_TEST_GROUP_NUMBER(SHELL-VAR) # ------------------------------------------ @@ -268,13 +263,12 @@ at_fn_banner () AS_ECHO(["$as_nl$at_banner_text$as_nl"]) } # at_fn_banner -AS_FUNCTION_DESCRIBE([at_fn_check_prepare_notrace], [REASON LINE], +AS_FUNCTION_DESCRIBE([at_fn_check_prepare_notrace], [LINE], [Perform AT_CHECK preparations for the command at LINE for an -untraceable command; REASON is the reason for disabling tracing.]) +untraceable command, or when tracing is disabled.]) at_fn_check_prepare_notrace () { - $at_trace_echo "Not enabling shell tracing (command contains $1)" - AS_ECHO(["$[2]"]) >"$at_check_line_file" + AS_ECHO(["$[1]"]) >"$at_check_line_file" at_check_trace=: at_check_filter=: : >"$at_stdout"; : >"$at_stderr" } @@ -284,9 +278,13 @@ AS_FUNCTION_DESCRIBE([at_fn_check_prepare_trace], [LINE], command.]) at_fn_check_prepare_trace () { - AS_ECHO(["$[1]"]) >"$at_check_line_file" - at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace - : >"$at_stdout"; : >"$at_stderr" + 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_FUNCTION_DESCRIBE([at_fn_check_prepare_dynamic], [COMMAND LINE], @@ -294,9 +292,12 @@ AS_FUNCTION_DESCRIBE([at_fn_check_prepare_dynamic], [COMMAND LINE], appropriate preparation function.]) at_fn_check_prepare_dynamic () { - case $[1] in + case "$at_traceon:$[1]" in + :*$as_nl*) + at_fn_check_prepare_notrace "$[2]" ;; *$as_nl*) - at_fn_check_prepare_notrace 'an embedded newline' "$[2]" ;; + echo 'Not enabling shell tracing (command contains an embedded newline)' + at_fn_check_prepare_notrace "$[2]" ;; *) at_fn_check_prepare_trace "$[2]" ;; esac @@ -406,9 +407,6 @@ 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. @@ -524,9 +522,7 @@ do ;; --trace | -x ) - at_traceon='set -x' - at_trace_echo=echo - at_check_filter_trace=at_fn_filter_trace + at_traceon='set -x'; at_traceoff='set +x' ;; [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) @@ -1780,36 +1776,6 @@ m4_divert_push([TEST_SCRIPT])dnl ]) -# AT_FAIL_IF(SHELL-EXPRESSION) -# ----------------------------- -# Set up the test to be expected to fail if SHELL-EXPRESSION evaluates to -# true (exitcode = 0). -_AT_DEFINE_SETUP([AT_FAIL_IF], -[dnl -dnl Try to limit the amount of conditionals that we emit. -m4_case([$1], - [], [], - [false], [], - [:], [_AT_CHECK_EXIT([], [99])], - [true], [_AT_CHECK_EXIT([], [99])], - [_AT_CHECK_EXIT([$1], [99])])]) - - -# AT_SKIP_IF(SHELL-EXPRESSION) -# ----------------------------- -# Set up the test to be expected to fail if SHELL-EXPRESSION evaluates to -# true (exitcode = 0). -_AT_DEFINE_SETUP([AT_SKIP_IF], -[dnl -dnl Try to limit the amount of conditionals that we emit. -m4_case([$1], - [], [], - [false], [], - [:], [_AT_CHECK_EXIT([], [77])], - [true], [_AT_CHECK_EXIT([], [77])], - [_AT_CHECK_EXIT([$1], [77])])]) - - # AT_XFAIL_IF(SHELL-EXPRESSION) # ----------------------------- # Set up the test to be expected to fail if SHELL-EXPRESSION evaluates to @@ -1862,7 +1828,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 - set +x + $at_traceoff $at_times_p && times >"$at_times_file" ) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe read at_status <"$at_status_file" @@ -2050,7 +2016,8 @@ m4_cond([m4_eval(m4_index([$1], [`]) >= 0)], [1], []))]dnl No reason. [m4_if(m4_index(_m4_defn([at_reason]), [a]), [0],]dnl dnl We know at build time that tracing COMMANDS is never safe. -[[at_fn_check_prepare_notrace 'm4_defn([at_reason])'],dnl +[[echo 'Not enabling shell tracing (command contains ]m4_defn([at_reason])[)' +at_fn_check_prepare_notrace], m4_index([$1], [$]), [-1],]dnl dnl We know at build time that tracing COMMANDS is always safe. [[at_fn_check_prepare_trace],]dnl @@ -2123,9 +2090,9 @@ m4_define([AT_DIFF_STDOUT()], # with parallel jobs. m4_define([_AT_CHECK], [m4_define([AT_ingroup])]dnl -[{ set +x +[{ $at_traceoff AS_ECHO(["$at_srcdir/AT_LINE: AS_ESCAPE([[$1]])"]) -_AT_DECIDE_TRACEABLE([$1]) _AT_LINE_ESCAPED +_AT_DECIDE_TRACEABLE([$1]) "AS_ESCAPE(m4_dquote(AT_LINE))" ( $at_check_trace; [$1] ) >>"$at_stdout" 2>>"$at_stderr" at_status=$? at_failed=false @@ -2142,11 +2109,3 @@ m4_ifvaln([$5$6], [AS_IF($at_failed, [$5], [$6])])]dnl [$at_failed && at_fn_log_failure AT_capture_files $at_traceon; } ])# _AT_CHECK - -# _AT_CHECK_EXIT(COMMANDS, [EXIT-STATUS-IF-PASS]) -# ----------------------------------------------- -# Minimal version of _AT_CHECK for AT_SKIP_IF and AT_FAIL_IF. -m4_define([_AT_CHECK_EXIT], -[m4_define([AT_ingroup])]dnl -[AS_ECHO(_AT_LINE_ESCAPED) >"$at_check_line_file" -m4_ifval([$1], [$1 && ])at_fn_check_skip $2])# _AT_CHECK_EXIT diff --git a/m4/m4.m4 b/m4/m4.m4 index 45e03fca..dd90cca5 100644 --- a/m4/m4.m4 +++ b/m4/m4.m4 @@ -32,17 +32,6 @@ AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4 gnum4], [AC_MSG_ERROR([no acceptable m4 could be found in \$PATH. GNU M4 1.4.5 or later is required; 1.4.11 is recommended])])]) M4=$ac_cv_path_M4 - AC_CACHE_CHECK([whether $ac_cv_path_M4 accepts -g], [ac_cv_prog_gnu_m4_gnu], - [case `$M4 --help < /dev/null 2>&1` in - *--gnu*) ac_cv_prog_gnu_m4_gnu=yes ;; - *) ac_cv_prog_gnu_m4_gnu=no ;; - esac]) - if test "$ac_cv_prog_gnu_m4_gnu" = yes; then - M4_GNU=-g - else - M4_GNU= - fi - AC_SUBST([M4_GNU]) AC_CACHE_CHECK([how m4 supports trace files], [ac_cv_prog_gnu_m4_debugfile], [case `$M4 --help < /dev/null 2>&1` in *debugfile*) ac_cv_prog_gnu_m4_debugfile=--debugfile ;; diff --git a/tests/atlocal.in b/tests/atlocal.in index adce2bf8..ad72c374 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -29,16 +29,27 @@ ac_cv_sh_n_works='@ac_cv_sh_n_works@' # Check whether the underlying system can manage some unusual # symbols in file names. -if test -z '@ac_cv_unsupported_fs_chars@'; then +unsupported_fs_chars= +for c in '\\' '"' '<' '>' '*' '?' '|' +do + touch "t${c}t" 2>/dev/null + test -f "t${c}t" && rm -f "t${c}t" && continue + # $c cannot be used in a file name. + unsupported_fs_chars=$unsupported_fs_chars$c +done +if test -z "$unsupported_fs_chars"; then func_sanitize_file_name () { echo "$@"; } else - func_sanitize_file_name () { echo "$@" | tr -d '@ac_cv_unsupported_fs_chars@'; } + func_sanitize_file_name () { echo "$@" | tr -d "$unsupported_fs_chars"; } fi # Can we create directories with trailing whitespaces in their name? -ac_cv_dir_trailing_space='@ac_cv_dir_trailing_space@' -if test "$ac_cv_dir_trailing_space" = yes; then - func_sanitize_dir_name () { echo "$@"; } -else - func_sanitize_dir_name () { echo "$@" | sed 's/ *$//'; } -fi +rm -rf 'tdir ' && mkdir 'tdir ' && touch 'tdir /tfile' 2>/dev/null +a=$? +rm -rf 'tdir ' +case $a$? in #( +00) + func_sanitize_dir_name () { echo "$@"; } ;; #( +*) + func_sanitize_dir_name () { echo "$@" | sed 's/ *$//'; } ;; +esac diff --git a/tests/autotest.at b/tests/autotest.at index d6bf58df..438c01dc 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -169,21 +169,6 @@ AT_SETUP([only test]) AT_CHECK([:]) ]], [missing AT@&t@_CLEANUP detected]) -AT_CHECK_AT_SYNTAX([AT@&t@_FAIL_IF without AT@&t@_SETUP], -[[AT_INIT([incomplete test suite]) -AT_FAIL_IF([:]) -]], [AT@&t@_FAIL_IF: missing AT@&t@_SETUP detected]) - -AT_CHECK_AT_SYNTAX([AT@&t@_SKIP_IF without AT@&t@_SETUP], -[[AT_INIT([incomplete test suite]) -AT_SKIP_IF([:]) -]], [AT@&t@_SKIP_IF: missing AT@&t@_SETUP detected]) - -AT_CHECK_AT_SYNTAX([AT@&t@_CHECK without AT@&t@_SETUP], -[[AT_INIT([incomplete test suite]) -AT_CHECK([:]) -]], [AT@&t@_CHECK: missing AT@&t@_SETUP detected]) - AT_CHECK_AT_SYNTAX([AT@&t@_CHECK without AT@&t@_SETUP], [[AT_INIT([incomplete test suite]) AT_CHECK([:]) @@ -278,46 +263,6 @@ AT_CHECK_AT_TEST([Hard fail], [AT_CHECK([grep '2 failed unexpectedly' micro-suite.log], [], [ignore]) AT_CHECK([grep ok micro-suite.log], [1])]) -AT_CHECK_AT_TEST([AT@&t@_FAIL_IF], - [AT_FAIL_IF([:]) - AT_CLEANUP - AT_SETUP - AT_FAIL_IF([false]) - AT_CLEANUP - AT_SETUP - AT_FAIL_IF([test x = y]) - AT_CLEANUP - AT_SETUP - AT_FAIL_IF([bah]) - AT_CLEANUP - AT_SETUP - AT_FAIL_IF([test x = x]) - AT_CLEANUP - AT_SETUP - AT_FAIL_IF([test $foo = x])], - [], [1], [stdout], [ignore], [], - [AT_CHECK([grep '1 5 failed' stdout], [], [ignore], [ignore])]) - -AT_CHECK_AT_TEST([AT@&t@_SKIP_IF], - [AT_SKIP_IF([:]) - AT_CLEANUP - AT_SETUP - AT_SKIP_IF([false]) - AT_CLEANUP - AT_SETUP - AT_SKIP_IF([test x = y]) - AT_CLEANUP - AT_SETUP - AT_SKIP_IF([bah]) - AT_CLEANUP - AT_SETUP - AT_SKIP_IF([test x = x]) - AT_CLEANUP - AT_SETUP - AT_SKIP_IF([test $foo = x])], - [], [], [], [], [], - [AT_CHECK([grep '2.*skipped' micro-suite.log], [], [ignore], [ignore])]) - AT_CHECK_AT_TEST([Syntax error], [AT_CHECK([:]) AT_CLEANUP @@ -1045,8 +990,8 @@ m4_define([AT_SKIP_PARALLEL_TESTS], [# Per BUGS, we have not yet figured out how to run parallel tests cleanly # under dash and some ksh variants. For now, only run this test under # limited conditions; help is appreciated in widening this test base. -AT_SKIP_IF([${CONFIG_SHELL-$SHELL} -c 'test -z "${BASH_VERSION+set}]]dnl -[[${ZSH_VERSION+set}${TEST_PARALLEL_AUTOTEST+set}"']) +AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'test -n "${BASH_VERSION+set}]]dnl +[[${ZSH_VERSION+set}${TEST_PARALLEL_AUTOTEST+set}"' || exit 77]) # The parallel scheduler requires mkfifo and job control to work. AT_CHECK([mkfifo fifo || exit 77]) AT_CHECK([${CONFIG_SHELL-$SHELL} -c '(set -m && set +m) || exit 77'], diff --git a/tests/local.at b/tests/local.at index 8a81835b..9beea3ac 100644 --- a/tests/local.at +++ b/tests/local.at @@ -50,8 +50,8 @@ AT_CHECK([$at_diff "$1" "$2"]) # If the shell handles `-n' well, use it to check the syntax of PROGRAM; # otherwise, do nothing. m4_define([AT_CHECK_SHELL_SYNTAX], -[AT_SKIP_IF([test "$ac_cv_sh_n_works" != yes]) -AT_CHECK([/bin/sh -n $1])]) +[AS_IF([test "$ac_cv_sh_n_works" = yes], + [AT_CHECK([/bin/sh -n $1])])]) m4_define([AT_CHECK_PERL_SYNTAX], [AT_CHECK([autom4te_perllibdir=$abs_top_srcdir/lib $PERL -c "$abs_top_builddir"/bin/$1],