From: Akim Demaille Date: Mon, 7 Feb 2000 14:22:37 +0000 (+0000) Subject: * tests/atgeneral.m4: Updated. X-Git-Tag: autoconf-2.50~1239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78a1aa6fc32f2492e2c59b78bb9bc2316260ebdd;p=thirdparty%2Fautoconf.git * tests/atgeneral.m4: Updated. (AT_CASE): new macro. (AT_CHECK): Use it. Don't changequote for patsubst, there is no need. * tests/syntax.m4 (TEST_MACRO): Don't run AC_ARG_VAR. Reported by Jim Meyering. Use AT_CASE. --- diff --git a/ChangeLog b/ChangeLog index 7954e510c..8ed2fb703 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-02-07 Akim Demaille + + * tests/atgeneral.m4: Updated. + (AT_CASE): new macro. + (AT_CHECK): Use it. Don't changequote for patsubst, there is no + need. + * tests/syntax.m4 (TEST_MACRO): Don't run AC_ARG_VAR. + Reported by Jim Meyering. + Use AT_CASE. + 2000-02-07 Akim Demaille Test that the macros respect the user variable name space. diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 3424f9c69..8193fee5a 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -2,6 +2,49 @@ divert(-1) -*- shell-script -*- # `m4' macros used in building test suites. # Copyright (C) 2000 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# This script is part of Autotest. Unlimited permission to copy, +# distribute and modify the testing scripts that are the output of +# that Autotest script is given. You need not follow the terms of the +# GNU General Public License when using or distributing such scripts, +# even though portions of the text of Autotest appear in them. The +# GNU General Public License (GPL) does govern all other use of the +# material that constitutes the Autotest. +# +# Certain portions of the Autotest source text are designed to be +# copied (in certain cases, depending on the input) into the output of +# Autotest. We call these the "data" portions. The rest of the +# Autotest source text consists of comments plus executable code that +# decides which of the data portions to output in any given case. We +# call these comments and executable code the "non-data" portions. +# Autotest never copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autotest +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autotest, you may extend this +# special exception to the GPL to apply to your modified version as +# well, *unless* your modified version has the potential to copy into +# its output some of the text that was the non-data portion of the +# version that you started with. (In other words, unless your change +# moves or copies text from the non-data portions to the data +# portions.) If your modification has such potential, you must delete +# any notice of this special exception to the GPL from your modified +# version. + changequote([, ]) define(AT_DEFINE, defn([define])) @@ -18,6 +61,36 @@ undefine([include]) undefine([shift]) undefine([undefine]) +# AT_CASE(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT) + +# m4 equivalent of +# switch (SWITCH) +# { +# case VAL1: +# IF-VAL1; +# break; +# case VAL2: +# IF-VAL2; +# break; +# ... +# default: +# DEFAULT; +# break; +# }. +# All the values are optional, and the macro is robust to active +# symbols properly quoted. +AT_DEFINE(AT_CASE, +[ifelse([$1], 1,, + [$#], 2, [$2], + [$1], [$2], [$3], + [AT_CASE([$1], AT_SHIFT(AT_SHIFT($@)))])]) + +# Use of diversions: +# 0 - overall initialization; for each test group: skipping and cleanups; +# 1 - for each test group: proper code, to reinsert between cleanups; +# 2 - overall wrap up: generation of debugging scripts and statistics. + + # AT_LINE # Return the current file sans directory, a colon, and the current line. @@ -25,11 +98,10 @@ undefine([undefine]) AT_DEFINE(AT_LINE, [patsubst(__file__, ^.*/\(.*\), \1):__line__]) -# AT_INIT(PROGRAM, RELPATH) +# AT_INIT(PROGRAM) -# Begin testing suite, using PROGRAM to check version, and RELPATH as a -# relative path (usually `../src') to find executable binaries to test. -# RELPATH may be omitted; `.' is always added in front of the search path. +# Begin testing suite, using PROGRAM to check version. The search path +# should be already preset so the proper executable will be selected. AT_DEFINE(AT_INIT, [AT_DEFINE(AT_ordinal, 0) @@ -38,26 +110,28 @@ AT_DEFINE(AT_INIT, at_usage="Usage: [$]0 [OPTION]... - -e Stop and inhibit normal clean up if a test of the full test suite fails + -e Abort the full suite and inhibit normal clean up if a test fails -n Do not redirect stdout and stderr and do not test their contents - -s Inhibit verbosity in debugging scripts, at generation or at execution + -s Inhibit verbosity while generating or executing debugging scripts -v Force more detailed output, default for debugging scripts unless -s - -x Have the shell to trace command execution; implies options -n" + -x Have the shell to trace command execution; also implies option -n" while test [$][#] -gt 0; do case "[$]1" in + --help) echo "$at_usage"; exit 0 ;; + --version) echo "[$]0 ($at_package) $at_version"; exit 0 ;; -e) at_stop_on_error=1; shift ;; -n) at_no_redirs=1; shift ;; -s) at_verbose=; at_silent=1; shift ;; -v) at_verbose=1; at_silent=; shift ;; - -x) at_tracex=1; at_no_redirs=1; shift ;; - *) echo 1>&2 "$at_usage"; exit 1 ;; + -x) at_traceon='set -vx'; at_traceoff='set +vx'; at_no_redirs=1; shift ;; + *) echo 1>&2 "Try \`[$]0 --help' for more information."; exit 1 ;; esac done # In the testing suite, we only want to know if the test succeeded or failed. # But in debugging scripts, we want more information, so we prefer `diff -u' -# to silent `cmp', even if it may happen that we compare binary files. +# to the silent `cmp', even if it may happen that we compare binary files. # Option `-u' might be less portable, so either change it or use GNU `diff'. if test -n "$at_verbose"; then @@ -108,13 +182,24 @@ else for at_group in $at_failed_list; do echo $at_n " $at_group$at_c" ( echo '#!/bin/sh' - sed -n "/^[#] Snippet (1/,/^[#] Snippet )1/p" atconfig + sed -n '/^[#] Snippet (1/,/^[#] Snippet )1/p' atconfig test -z "$at_silent" && echo 'at_verbose=1' - sed -n "/^[#] Snippet (2/,/^[#] Snippet )2/p" atconfig + sed -n '/^[#] Snippet (2/,/^[#] Snippet )2/p' atconfig sed -n "/^[#] Snippet (3/,/^[#] Snippet )3/p" [$]0 sed -n "/^[#] Snippet (c$at_group(/,/^[#] Snippet )c$at_group)/p" [$]0 - echo 'test -n "$at_verbose" \ - && echo "[$]0:1: =================================================="' + at_desc="`sed -n \ + '/^[#] Snippet (d'$at_group'(/,/^[#] Snippet )d'$at_group')/p' [$]0 \ + | sed -n '2s/^[#] //p'`" + echo 'if test -n "$at_verbose"; then' + echo ' at_banner="[$]0: '$at_desc'"' + echo ' at_dashes=`echo $at_banner | sed s/./=/g`' + echo ' echo' + echo ' echo "$at_dashes"' + echo ' echo "$at_banner"' + echo ' echo "$at_dashes"' + echo 'fi' + echo + sed -n "/^[#] Snippet (d$at_group(/,/^[#] Snippet )d$at_group)/p" [$]0 sed -n "/^[#] Snippet (s$at_group(/,/^[#] Snippet )s$at_group)/p" [$]0 echo 'exit 0' ) | grep -v '^[#] Snippet' > debug-$at_group.sh @@ -123,7 +208,7 @@ else done echo ', done' if test -n "$at_stop_on_error"; then - at_banner="ERROR: One of the tests failed, inhibiting subsequent tests" + at_banner='ERROR: One of the tests failed, inhibiting subsequent tests' else at_banner="ERROR: Suite unsuccessful, $at_fail_count of $at_test_count tests failed" fi @@ -137,8 +222,13 @@ echo "$at_dashes" if test -n "$at_failed_list"; then if test -z "$at_silent"; then echo - echo "Now, failed tests will be executed again, with more details..." - echo + echo 'When reporting failed tests to maintainers, do not merely list test' + echo 'numbers, as the numbering changes between releases and pretests.' + echo 'Be careful to give at least all the information you got about them.' + echo 'You may investigate any problem if you feel able to do so, in which' + echo 'case the generated debugging scripts provide good starting points.' + echo "Go on and modify them at will. \`./debug-NN --help' gives usage" + echo 'information. Now, failed tests will be executed again, verbosely.' for at_group in $at_failed_list; do ./debug-$at_group.sh done @@ -169,11 +259,14 @@ divert(1)[]dnl echo $at_n " $at_c" fi echo $at_n "substr(AT_ordinal. $srcdir/AT_LINE , 0, 30)[]$at_c" - ( + if test -z "$at_skip_mode"; then + ( +[#] Snippet (d[]AT_ordinal[]( +[#] Testing AT_group_description +[#] Snippet )d[]AT_ordinal[]) [#] Snippet (s[]AT_ordinal[]( - -[#] The test group starts at `AT_LINE'. An error occurred while -[#] testing AT_group_description. +[#] starting from `AT_LINE'. +$at_traceon ]) @@ -184,18 +277,23 @@ divert(1)[]dnl # nor files created with AT_DATA. AT_DEFINE(AT_CLEANUP, +$at_traceoff [[#] Snippet )s[]AT_ordinal[]) - ) - case [$]? in - 0) echo ok - ;; - 77) echo "ignored near \``cat at-check-line`'" - at_ignore_count=`expr $at_ignore_count + 1` - ;; - *) echo "FAILED near \``cat at-check-line`'" - at_failed_list="$at_failed_list AT_ordinal" - ;; - esac + ) + case [$]? in + 0) echo ok + ;; + 77) echo "ignored near \``cat at-check-line`'" + at_ignore_count=`expr $at_ignore_count + 1` + ;; + *) echo "FAILED near \``cat at-check-line`'" + at_failed_list="$at_failed_list AT_ordinal" + ;; + esac + else + echo 'ignored (skipped)' + at_ignore_count=`expr $at_ignore_count + 1` + fi at_test_count=AT_ordinal if test -z "$at_stop_on_error" || test -z "$at_failed_list"; then divert(0)[]dnl @@ -238,11 +336,12 @@ $2[]EOF # their content is not checked. AT_DEFINE(AT_CHECK, -[test -n "$at_verbose" \ - && echo $srcdir'/AT_LINE: Testing AT_group_description' +[$at_traceoff +test -n "$at_verbose" \ + && echo "$srcdir/AT_LINE: testing..." echo AT_LINE > at-check-line test -z "$at_no_redirs" && exec 5>&1 6>&2 1>stdout 2>stderr -test -n "$at_tracex" && set -x +$at_traceon $1 ifelse([$2],,, [at_status=$? @@ -253,30 +352,23 @@ dnl Exit with the same code, at least to preserve 77. exit $at_status fi ])dnl -test -n "$at_tracex" && set +x +$at_traceoff if test -z "$at_no_redirs"; then exec 1>&5 2>&6 - ifelse([$3], ignore, [test -n "$at_verbose" && cat stdout;: -], - [$3], expout, [AT_DEFINE([AT_data_expout], [ expout])dnl -$at_diff expout stdout || exit 1 -], - [$3], , [$at_diff /dev/null stdout || exit 1 -], - [changequote({{, }})dnl -echo $at_n "patsubst({{$3}}, \([\"`$]\), \\\1)$at_c" | $at_diff - stdout || exit 1 -changequote([, ])])dnl - ifelse([$4], ignore, [test -n "$at_verbose" && cat stderr;: -], - [$4], experr, [AT_DEFINE([AT_data_experr], [ experr])dnl -$at_diff experr stderr || exit 1 -], - [$4], , [$at_diff /dev/null stderr || exit 1 -], - [changequote({{, }})dnl -echo $at_n "patsubst({{$4}}, \([\"`$]\), \\\1)$at_c" | $at_diff - stderr || exit 1 -changequote([, ])])dnl + AT_CASE([$3], + ignore, [test -n "$at_verbose" && cat stdout;:], + expout, [AT_DEFINE([AT_data_expout], [ expout])dnl +$at_diff expout stdout || exit 1], + [], [$at_diff /dev/null stdout || exit 1], + [echo $at_n "patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stdout || exit 1]) + AT_CASE([$4], + ignore, [test -n "$at_verbose" && cat stderr;:], + experr, [AT_DEFINE([AT_data_experr], [ experr])dnl +$at_diff experr stderr || exit 1], + [], [$at_diff /dev/null stderr || exit 1], + [echo $at_n "patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stderr || exit 1]) fi +$at_traceon ]) divert[]dnl diff --git a/tests/atconfig.in b/tests/atconfig.in index 5cab3d804..618ea5857 100644 --- a/tests/atconfig.in +++ b/tests/atconfig.in @@ -27,5 +27,9 @@ top_srcdir=@top_srcdir@ # Use absolute file notations, as the test might change directories. at_srcdir=`cd @srcdir@ && pwd` at_top_srcdir=`cd @top_srcdir@ && pwd` -export PATH; PATH=`pwd`:`cd @AT_TESTPATH@ && pwd`:$PATH +if test -n "@AT_TESTPATH@"; then + export PATH; PATH=`pwd`:`cd @AT_TESTPATH@ && pwd`:$PATH +else + export PATH; PATH=`pwd`:$PATH +fi # Snippet )2 diff --git a/tests/atgeneral.m4 b/tests/atgeneral.m4 index 3424f9c69..8193fee5a 100644 --- a/tests/atgeneral.m4 +++ b/tests/atgeneral.m4 @@ -2,6 +2,49 @@ divert(-1) -*- shell-script -*- # `m4' macros used in building test suites. # Copyright (C) 2000 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# This script is part of Autotest. Unlimited permission to copy, +# distribute and modify the testing scripts that are the output of +# that Autotest script is given. You need not follow the terms of the +# GNU General Public License when using or distributing such scripts, +# even though portions of the text of Autotest appear in them. The +# GNU General Public License (GPL) does govern all other use of the +# material that constitutes the Autotest. +# +# Certain portions of the Autotest source text are designed to be +# copied (in certain cases, depending on the input) into the output of +# Autotest. We call these the "data" portions. The rest of the +# Autotest source text consists of comments plus executable code that +# decides which of the data portions to output in any given case. We +# call these comments and executable code the "non-data" portions. +# Autotest never copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autotest +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autotest, you may extend this +# special exception to the GPL to apply to your modified version as +# well, *unless* your modified version has the potential to copy into +# its output some of the text that was the non-data portion of the +# version that you started with. (In other words, unless your change +# moves or copies text from the non-data portions to the data +# portions.) If your modification has such potential, you must delete +# any notice of this special exception to the GPL from your modified +# version. + changequote([, ]) define(AT_DEFINE, defn([define])) @@ -18,6 +61,36 @@ undefine([include]) undefine([shift]) undefine([undefine]) +# AT_CASE(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT) + +# m4 equivalent of +# switch (SWITCH) +# { +# case VAL1: +# IF-VAL1; +# break; +# case VAL2: +# IF-VAL2; +# break; +# ... +# default: +# DEFAULT; +# break; +# }. +# All the values are optional, and the macro is robust to active +# symbols properly quoted. +AT_DEFINE(AT_CASE, +[ifelse([$1], 1,, + [$#], 2, [$2], + [$1], [$2], [$3], + [AT_CASE([$1], AT_SHIFT(AT_SHIFT($@)))])]) + +# Use of diversions: +# 0 - overall initialization; for each test group: skipping and cleanups; +# 1 - for each test group: proper code, to reinsert between cleanups; +# 2 - overall wrap up: generation of debugging scripts and statistics. + + # AT_LINE # Return the current file sans directory, a colon, and the current line. @@ -25,11 +98,10 @@ undefine([undefine]) AT_DEFINE(AT_LINE, [patsubst(__file__, ^.*/\(.*\), \1):__line__]) -# AT_INIT(PROGRAM, RELPATH) +# AT_INIT(PROGRAM) -# Begin testing suite, using PROGRAM to check version, and RELPATH as a -# relative path (usually `../src') to find executable binaries to test. -# RELPATH may be omitted; `.' is always added in front of the search path. +# Begin testing suite, using PROGRAM to check version. The search path +# should be already preset so the proper executable will be selected. AT_DEFINE(AT_INIT, [AT_DEFINE(AT_ordinal, 0) @@ -38,26 +110,28 @@ AT_DEFINE(AT_INIT, at_usage="Usage: [$]0 [OPTION]... - -e Stop and inhibit normal clean up if a test of the full test suite fails + -e Abort the full suite and inhibit normal clean up if a test fails -n Do not redirect stdout and stderr and do not test their contents - -s Inhibit verbosity in debugging scripts, at generation or at execution + -s Inhibit verbosity while generating or executing debugging scripts -v Force more detailed output, default for debugging scripts unless -s - -x Have the shell to trace command execution; implies options -n" + -x Have the shell to trace command execution; also implies option -n" while test [$][#] -gt 0; do case "[$]1" in + --help) echo "$at_usage"; exit 0 ;; + --version) echo "[$]0 ($at_package) $at_version"; exit 0 ;; -e) at_stop_on_error=1; shift ;; -n) at_no_redirs=1; shift ;; -s) at_verbose=; at_silent=1; shift ;; -v) at_verbose=1; at_silent=; shift ;; - -x) at_tracex=1; at_no_redirs=1; shift ;; - *) echo 1>&2 "$at_usage"; exit 1 ;; + -x) at_traceon='set -vx'; at_traceoff='set +vx'; at_no_redirs=1; shift ;; + *) echo 1>&2 "Try \`[$]0 --help' for more information."; exit 1 ;; esac done # In the testing suite, we only want to know if the test succeeded or failed. # But in debugging scripts, we want more information, so we prefer `diff -u' -# to silent `cmp', even if it may happen that we compare binary files. +# to the silent `cmp', even if it may happen that we compare binary files. # Option `-u' might be less portable, so either change it or use GNU `diff'. if test -n "$at_verbose"; then @@ -108,13 +182,24 @@ else for at_group in $at_failed_list; do echo $at_n " $at_group$at_c" ( echo '#!/bin/sh' - sed -n "/^[#] Snippet (1/,/^[#] Snippet )1/p" atconfig + sed -n '/^[#] Snippet (1/,/^[#] Snippet )1/p' atconfig test -z "$at_silent" && echo 'at_verbose=1' - sed -n "/^[#] Snippet (2/,/^[#] Snippet )2/p" atconfig + sed -n '/^[#] Snippet (2/,/^[#] Snippet )2/p' atconfig sed -n "/^[#] Snippet (3/,/^[#] Snippet )3/p" [$]0 sed -n "/^[#] Snippet (c$at_group(/,/^[#] Snippet )c$at_group)/p" [$]0 - echo 'test -n "$at_verbose" \ - && echo "[$]0:1: =================================================="' + at_desc="`sed -n \ + '/^[#] Snippet (d'$at_group'(/,/^[#] Snippet )d'$at_group')/p' [$]0 \ + | sed -n '2s/^[#] //p'`" + echo 'if test -n "$at_verbose"; then' + echo ' at_banner="[$]0: '$at_desc'"' + echo ' at_dashes=`echo $at_banner | sed s/./=/g`' + echo ' echo' + echo ' echo "$at_dashes"' + echo ' echo "$at_banner"' + echo ' echo "$at_dashes"' + echo 'fi' + echo + sed -n "/^[#] Snippet (d$at_group(/,/^[#] Snippet )d$at_group)/p" [$]0 sed -n "/^[#] Snippet (s$at_group(/,/^[#] Snippet )s$at_group)/p" [$]0 echo 'exit 0' ) | grep -v '^[#] Snippet' > debug-$at_group.sh @@ -123,7 +208,7 @@ else done echo ', done' if test -n "$at_stop_on_error"; then - at_banner="ERROR: One of the tests failed, inhibiting subsequent tests" + at_banner='ERROR: One of the tests failed, inhibiting subsequent tests' else at_banner="ERROR: Suite unsuccessful, $at_fail_count of $at_test_count tests failed" fi @@ -137,8 +222,13 @@ echo "$at_dashes" if test -n "$at_failed_list"; then if test -z "$at_silent"; then echo - echo "Now, failed tests will be executed again, with more details..." - echo + echo 'When reporting failed tests to maintainers, do not merely list test' + echo 'numbers, as the numbering changes between releases and pretests.' + echo 'Be careful to give at least all the information you got about them.' + echo 'You may investigate any problem if you feel able to do so, in which' + echo 'case the generated debugging scripts provide good starting points.' + echo "Go on and modify them at will. \`./debug-NN --help' gives usage" + echo 'information. Now, failed tests will be executed again, verbosely.' for at_group in $at_failed_list; do ./debug-$at_group.sh done @@ -169,11 +259,14 @@ divert(1)[]dnl echo $at_n " $at_c" fi echo $at_n "substr(AT_ordinal. $srcdir/AT_LINE , 0, 30)[]$at_c" - ( + if test -z "$at_skip_mode"; then + ( +[#] Snippet (d[]AT_ordinal[]( +[#] Testing AT_group_description +[#] Snippet )d[]AT_ordinal[]) [#] Snippet (s[]AT_ordinal[]( - -[#] The test group starts at `AT_LINE'. An error occurred while -[#] testing AT_group_description. +[#] starting from `AT_LINE'. +$at_traceon ]) @@ -184,18 +277,23 @@ divert(1)[]dnl # nor files created with AT_DATA. AT_DEFINE(AT_CLEANUP, +$at_traceoff [[#] Snippet )s[]AT_ordinal[]) - ) - case [$]? in - 0) echo ok - ;; - 77) echo "ignored near \``cat at-check-line`'" - at_ignore_count=`expr $at_ignore_count + 1` - ;; - *) echo "FAILED near \``cat at-check-line`'" - at_failed_list="$at_failed_list AT_ordinal" - ;; - esac + ) + case [$]? in + 0) echo ok + ;; + 77) echo "ignored near \``cat at-check-line`'" + at_ignore_count=`expr $at_ignore_count + 1` + ;; + *) echo "FAILED near \``cat at-check-line`'" + at_failed_list="$at_failed_list AT_ordinal" + ;; + esac + else + echo 'ignored (skipped)' + at_ignore_count=`expr $at_ignore_count + 1` + fi at_test_count=AT_ordinal if test -z "$at_stop_on_error" || test -z "$at_failed_list"; then divert(0)[]dnl @@ -238,11 +336,12 @@ $2[]EOF # their content is not checked. AT_DEFINE(AT_CHECK, -[test -n "$at_verbose" \ - && echo $srcdir'/AT_LINE: Testing AT_group_description' +[$at_traceoff +test -n "$at_verbose" \ + && echo "$srcdir/AT_LINE: testing..." echo AT_LINE > at-check-line test -z "$at_no_redirs" && exec 5>&1 6>&2 1>stdout 2>stderr -test -n "$at_tracex" && set -x +$at_traceon $1 ifelse([$2],,, [at_status=$? @@ -253,30 +352,23 @@ dnl Exit with the same code, at least to preserve 77. exit $at_status fi ])dnl -test -n "$at_tracex" && set +x +$at_traceoff if test -z "$at_no_redirs"; then exec 1>&5 2>&6 - ifelse([$3], ignore, [test -n "$at_verbose" && cat stdout;: -], - [$3], expout, [AT_DEFINE([AT_data_expout], [ expout])dnl -$at_diff expout stdout || exit 1 -], - [$3], , [$at_diff /dev/null stdout || exit 1 -], - [changequote({{, }})dnl -echo $at_n "patsubst({{$3}}, \([\"`$]\), \\\1)$at_c" | $at_diff - stdout || exit 1 -changequote([, ])])dnl - ifelse([$4], ignore, [test -n "$at_verbose" && cat stderr;: -], - [$4], experr, [AT_DEFINE([AT_data_experr], [ experr])dnl -$at_diff experr stderr || exit 1 -], - [$4], , [$at_diff /dev/null stderr || exit 1 -], - [changequote({{, }})dnl -echo $at_n "patsubst({{$4}}, \([\"`$]\), \\\1)$at_c" | $at_diff - stderr || exit 1 -changequote([, ])])dnl + AT_CASE([$3], + ignore, [test -n "$at_verbose" && cat stdout;:], + expout, [AT_DEFINE([AT_data_expout], [ expout])dnl +$at_diff expout stdout || exit 1], + [], [$at_diff /dev/null stdout || exit 1], + [echo $at_n "patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stdout || exit 1]) + AT_CASE([$4], + ignore, [test -n "$at_verbose" && cat stderr;:], + experr, [AT_DEFINE([AT_data_experr], [ experr])dnl +$at_diff experr stderr || exit 1], + [], [$at_diff /dev/null stderr || exit 1], + [echo $at_n "patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - stderr || exit 1]) fi +$at_traceon ]) divert[]dnl diff --git a/tests/suite.m4 b/tests/suite.m4 index ce87e282c..e6fd6ad15 100644 --- a/tests/suite.m4 +++ b/tests/suite.m4 @@ -28,10 +28,10 @@ AC_ENV_SAVE(env-after) AC_OUTPUT ]) -# FIXME: Here we just don't consider the stderr from Autoconf. -# Maybe some day we could be more precise and filter out warnings. -# The problem is that currently some warnings are spread on several -# lines, so grepping -v warning is not enough. +dnl FIXME: Here we just don't consider the stderr from Autoconf. +dnl Maybe some day we could be more precise and filter out warnings. +dnl The problem is that currently some warnings are spread on several +dnl lines, so grepping -v warning is not enough. AT_CHECK([../autoconf -m .. -l $at_srcdir], 0,, ignore) AT_CHECK([../autoheader -m .. -l $at_srcdir], 0,, ignore) AT_CHECK([./configure], 0, ignore, ignore) diff --git a/tests/syntax.m4 b/tests/syntax.m4 index 30222ffb7..82ba0ce9f 100644 --- a/tests/syntax.m4 +++ b/tests/syntax.m4 @@ -8,22 +8,25 @@ dnl FIXME: AC_INIT creates an infinite loop in m4 when called twice. dnl I inserted the exception here, not in Makefile.am, because it seems dnl better to me. I did not use m4_case, since libm4 is not ready yet. AT_DEFINE(TEST_MACRO, -[ifelse([$1], [AC_CHECK_FUNCS],, - [$1], [AC_CHECK_HEADERS],, - [$1], [AC_CHECK_MEMBER],, - [$1], [AC_CHECK_MEMBERS],, - [$1], [AC_CHECK_PROGS],, - [$1], [AC_CONFIG_AUX_DIR],, - [$1], [AC_CONFIG_AUX_DIRS],, - [$1], [AC_INIT],, - [$1], [AC_INIT_PARSE_ARGS],, - [$1], [AC_LINKER_OPTION],, - [$1], [AC_LINK_FILES],, - [$1], [AC_LIST_MEMBER_OF],, - [$1], [AC_PATH_PROGS],, - [$1], [AC_REPLACE_FUNCS],, - [$1], [AC_SEARCH_LIBS],, - [AT_TEST_MACRO([$1])])]) +[AT_CASE([$1], + [AC_ARG_VAR],, + [AC_CHECK_FUNCS],, + [AC_CHECK_HEADERS],, + [AC_CHECK_MEMBER],, + [AC_CHECK_MEMBERS],, + [AC_CHECK_PROGS],, + [AC_CONFIG_AUX_DIR],, + [AC_CONFIG_AUX_DIRS],, + [AC_INIT],, + [AC_INIT_PARSE_ARGS],, + [AC_LINKER_OPTION],, + [AC_LINK_FILES],, + [AC_LIST_MEMBER_OF],, + [AC_PATH_PROGS],, + [AC_REPLACE_FUNCS],, + [AC_SEARCH_LIBS],, + + [AT_TEST_MACRO([$1])])]) echo echo 'Syntax of macros and completeness of the header templates.'