From 5693a536c2ec7a9f801808814dd0eb7cd47cd57c Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 20 Aug 2001 14:45:00 +0000 Subject: [PATCH] Autotest invokes M4sh's initialization. * lib/autotest/general.m4: Adjust the diversion names. (AT_INIT): Run AS_INIT. Use the BINSH diversion to invoke /bin/sh. * tests/base.at, tests/m4sh.at, tests/m4sugar.at, tests/tools.at: * tests/torture.at: Respect M4sugar and M4sh macro name spaces. --- ChangeLog | 11 ++++++++ lib/autotest/general.m4 | 16 +++++------- tests/base.at | 12 ++++----- tests/m4sh.at | 58 +++++++++++++++++++++-------------------- tests/m4sugar.at | 5 +++- tests/tools.at | 16 +++++++----- tests/torture.at | 6 ++++- 7 files changed, 72 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55c8c83a..d0f608ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-08-20 Akim Demaille + + Autotest invokes M4sh's initialization. + + * lib/autotest/general.m4: Adjust the diversion names. + (AT_INIT): Run AS_INIT. + Use the BINSH diversion to invoke /bin/sh. + * tests/base.at, tests/m4sh.at, tests/m4sugar.at, tests/tools.at: + * tests/torture.at: Respect M4sugar and M4sh macro name spaces. + + 2001-08-20 Akim Demaille Let M4sh have its own diversions. diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 5eaf63da..da07734c 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -62,16 +62,13 @@ changequote()changequote([, ])include(m4sugar/m4sh.m4)# -*- Autoconf -*- # tail of the core for;case, overall wrap up, generation of debugging # scripts and statistics. -m4_define([_m4_divert(DEFAULT)], 0) +m4_define([_m4_divert(DEFAULT)], 5) m4_define([_m4_divert(OPTIONS)], 10) m4_define([_m4_divert(HELP)], 20) m4_define([_m4_divert(SETUP)], 30) m4_define([_m4_divert(TESTS)], 50) m4_define([_m4_divert(TAIL)], 60) -m4_divert_push([TESTS]) -m4_divert_push([KILL]) - # AT_LINE # ------- @@ -85,12 +82,13 @@ m4_define([AT_LINE], # Begin test suite, using PROGRAM to check version. The search path # should be already preset so the proper executable will be selected. m4_define([AT_INIT], -[m4_pattern_forbid([^_?AT_]) +[AS_INIT +m4_pattern_forbid([^_?AT_]) m4_define([AT_ordinal], 0) m4_define([AT_banner_ordinal], 0) m4_define([AT_data_files], [stdout expout at-* stderr experr ]) +m4_divert_text([BINSH], [@%:@! /bin/sh]) m4_divert_push([DEFAULT])dnl -#! /bin/sh AS_SHELL_SANITIZE SHELL=${CONFIG_SHELL-/bin/sh} @@ -313,8 +311,8 @@ fi $at_debug || rm -rf $at_data_files # Wrap up the test suite with summary statistics. -at_skip_count=`set dummy $at_skip_list; shift; echo $[#]` -at_fail_count=`set dummy $at_fail_list; shift; echo $[#]` +at_skip_count=`set dummy $at_skip_list; shift; echo $[@%:@]` +at_fail_count=`set dummy $at_fail_list; shift; echo $[@%:@]` if test $at_fail_count = 0; then if test $at_skip_count = 0; then AS_BOX([All $at_test_count tests were successful]) @@ -380,7 +378,7 @@ elif test $at_debug = false; then fi exit 0 -m4_divert_pop()dnl +m4_divert_pop([TAIL])dnl m4_wrap([m4_divert_text([DEFAULT], [# List of the tests. at_tests_all="AT_TESTS_ALL "])])dnl diff --git a/tests/base.at b/tests/base.at index 31523e0f..89684349 100644 --- a/tests/base.at +++ b/tests/base.at @@ -30,8 +30,8 @@ AT_SETUP([AC_REQUIRE: topological sort]) AT_DATA(configure.ac, [[define([REQUIRE_AND_CHECK], -[AC_REQUIRE([$1])dnl -test -z "$m4_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)]) +[AC_REQUIRE([$1]) +test -z "$m4@__@_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)]) AC_DEFUN([TEST1], [REQUIRE_AND_CHECK([TEST2a]) @@ -49,7 +49,7 @@ AC_DEFUN([TEST3], [REQUIRE_AND_CHECK([TEST2a]) test3=set]) -AC_PLAIN_SCRIPT()dnl +AC_PLAIN_SCRIPT() #! /bin/sh TEST1 @@ -82,7 +82,7 @@ AC_DEFUN([MULTI_TEST], AC_DEFUN_ONCE([SINGLE_TEST], [single_test=".$single_test"]) -AC_PLAIN_SCRIPT()dnl +AC_PLAIN_SCRIPT() #! /bin/sh TEST @@ -127,7 +127,7 @@ AC_DEFUN([MULTI_TEST], AC_DEFUN_ONCE([SINGLE_TEST], [single_test=".$single_test"]) -AC_PLAIN_SCRIPT()dnl +AC_PLAIN_SCRIPT() #! /bin/sh MULTI_TEST @@ -167,7 +167,7 @@ AT_DATA([configure.ac], AC_DEFUN([INNER_TEST], [inner_test=".$inner_test"]) -AC_PLAIN_SCRIPT()dnl +AC_PLAIN_SCRIPT() #! /bin/sh AC_PROVIDE([INNER_TEST]) diff --git a/tests/m4sh.at b/tests/m4sh.at index ce17d880..c70f46a4 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -19,22 +19,24 @@ AT_BANNER([M4sh.]) # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. +# Used in many tests. +m4_pattern_allow([^AS_EXIT$]) ## ----------------------------- ## ## AS_DIRNAME & AS_DIRNAME_SED. ## ## ----------------------------- ## # Build nested dirs. - +m4_pattern_allow([^AS_DIRNAME(_SED)?$]) AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]]) AT_DATA(configure.ac, -[[AC_PLAIN_SCRIPT()dnl +[[AC_PLAIN_SCRIPT() #! /bin/sh -_AS_EXPR_PREPARE +_AS@__@_EXPR_PREPARE -define([AS_DIRNAME_TEST], +m4_define([DIRNAME_TEST], [dir=`AS_DIRNAME([$1])` test "$dir" = "$2" || echo "dirname($1) = $dir instead of $2" >&2 @@ -43,26 +45,26 @@ dir=`AS_DIRNAME_SED([$1])` test "$dir" = "$2" || echo "dirname_sed($1) = $dir instead of $2" >&2]) -AS_DIRNAME_TEST([//1], [//]) -AS_DIRNAME_TEST([/1], [/]) -AS_DIRNAME_TEST([./1], [.]) -AS_DIRNAME_TEST([../../2], [../..]) -AS_DIRNAME_TEST([//1/], [//]) -AS_DIRNAME_TEST([/1/], [/]) -AS_DIRNAME_TEST([./1/], [.]) -AS_DIRNAME_TEST([../../2], [../..]) -AS_DIRNAME_TEST([//1/3], [//1]) -AS_DIRNAME_TEST([/1/3], [/1]) -AS_DIRNAME_TEST([./1/3], [./1]) -AS_DIRNAME_TEST([../../2/3], [../../2]) -AS_DIRNAME_TEST([//1/3///], [//1]) -AS_DIRNAME_TEST([/1/3///], [/1]) -AS_DIRNAME_TEST([./1/3///], [./1]) -AS_DIRNAME_TEST([../../2/3///], [../../2]) -AS_DIRNAME_TEST([//1//3/], [//1]) -AS_DIRNAME_TEST([/1//3/], [/1]) -AS_DIRNAME_TEST([./1//3/], [./1]) -AS_DIRNAME_TEST([../../2//3/], [../../2]) +DIRNAME_TEST([//1], [//]) +DIRNAME_TEST([/1], [/]) +DIRNAME_TEST([./1], [.]) +DIRNAME_TEST([../../2], [../..]) +DIRNAME_TEST([//1/], [//]) +DIRNAME_TEST([/1/], [/]) +DIRNAME_TEST([./1/], [.]) +DIRNAME_TEST([../../2], [../..]) +DIRNAME_TEST([//1/3], [//1]) +DIRNAME_TEST([/1/3], [/1]) +DIRNAME_TEST([./1/3], [./1]) +DIRNAME_TEST([../../2/3], [../../2]) +DIRNAME_TEST([//1/3///], [//1]) +DIRNAME_TEST([/1/3///], [/1]) +DIRNAME_TEST([./1/3///], [./1]) +DIRNAME_TEST([../../2/3///], [../../2]) +DIRNAME_TEST([//1//3/], [//1]) +DIRNAME_TEST([/1//3/], [/1]) +DIRNAME_TEST([./1//3/], [./1]) +DIRNAME_TEST([../../2//3/], [../../2]) AS_EXIT(0) ]]) @@ -78,11 +80,11 @@ AT_CLEANUP(configure) ## ------------ ## # Build nested dirs. - +m4_pattern_allow([^AS_MKDIR_P$]) AT_SETUP([[AS_MKDIR_P]]) AT_DATA([configure.ac], -[[AC_PLAIN_SCRIPT()dnl +[[AC_PLAIN_SCRIPT() #! /bin/sh pwd=`pwd` @@ -116,7 +118,7 @@ AT_CLEANUP(configure 1 a) AT_SETUP([Negated classes in globbing]) AT_DATA([configure.ac], -[[AC_PLAIN_SCRIPT()dnl +[[AC_PLAIN_SCRIPT() #! /bin/sh case 'with!two!bangs' in @@ -132,4 +134,4 @@ esac AT_CHECK_AUTOCONF AT_CHECK_CONFIGURE -AT_CLEANUP(configure) +AT_CLEANUP diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 23e958b5..9bc62c37 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -32,6 +32,7 @@ AT_BANNER([M4sugar.]) ## m4_warn. ## ## --------- ## +m4_pattern_allow([^m4_warn$]) AT_SETUP([[m4_warn]]) # m4_text_wrap is used to display the help strings. Also, check that @@ -73,6 +74,7 @@ AT_CLEANUP ## m4_require: circular dependencies. ## ## ----------------------------------- ## +m4_pattern_allow([^m4_(require|defun|init)$]) AT_SETUP([[m4_require: circular dependencies]]) # m4_text_wrap is used to display the help strings. Also, check that @@ -111,6 +113,7 @@ AT_CLEANUP ## m4_text_wrap. ## ## -------------- ## +m4_pattern_allow([^m4_text_wrap$]) AT_SETUP([[m4_text_wrap]]) # m4_text_wrap is used to display the help strings. Also, check that @@ -118,7 +121,7 @@ AT_SETUP([[m4_text_wrap]]) # m4-listification. AT_DATA([script.s4g], -[[m4_divert_push([0])m4_wrap([m4_divert_pop([0])])dnl +[[m4@__@_divert_push([0])m4@__@_wrap([m4@__@_divert_pop([0])])d@__@nl m4_text_wrap([Short string */], [ ], [/* ], 20) m4_text_wrap([Much longer string */], [ ], [/* ], 20) diff --git a/tests/tools.at b/tests/tools.at index c826a4e4..45d0b1fd 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -133,6 +133,7 @@ AT_CLEANUP # ----------------------------- AT_SETUP([autoconf --trace: user macros]) +m4_pattern_allow([^m4_(define|shift)$]) AT_DATA(configure.ac, [[m4_define([active], [ACTIVE]) m4_define([TRACE1], [TRACE2(m4_shift($@))]) @@ -252,6 +253,7 @@ AT_CLEANUP # --------------------------------- AT_SETUP([autoconf: forbidden tokens, basic]) +m4_pattern_allow([^(m4_foo|_m4_bar|AS_FOO|_AS_BAR)$]) AT_DATA([configure.ac], [[AC_PLAIN_SCRIPT() AC_FOO @@ -262,7 +264,7 @@ BAC_FOO B_AC_FOO AS_FOO _AS_BAR -[dnl] +[d@__@nl] ]]) AT_CHECK_AUTOCONF([], 1, [], @@ -273,7 +275,7 @@ configure.ac:5: error: possibly undefined macro: _m4_bar configure.ac:7: error: possibly undefined macro: B_AC_FOO configure.ac:8: error: possibly undefined macro: AS_FOO configure.ac:9: error: possibly undefined macro: _AS_BAR -configure.ac:10: error: possibly undefined macro: dnl +configure.ac:10: error: possibly undefined macro: d@__@nl ]]) AT_CLEANUP @@ -284,16 +286,16 @@ AT_CLEANUP AT_SETUP([autoconf: forbidden tokens, exceptions]) AT_DATA([configure.ac], -[[AC_PLAIN_SCRIPT()dnl +[[AC_PLAIN_SCRIPT # This is allowed in spite of the name. # It is on purpose that we check the case where there are several # tokens on the same line. -m4_pattern_allow([^AC_ALLOWED$]) +m4@__@_pattern_allow([^AC_ALLOWED$]) NOT_AC_ALLOWED AC_ALLOWED AC_ALLOWED_NOT # Test forbidding. -m4_pattern_forbid([^FORBIDDEN$]) +m4@__@_pattern_forbid([^FORBIDDEN$]) NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT # Test Autoconf's patterns. @@ -464,7 +466,7 @@ AT_SETUP([autoupdate]) AT_DATA(configure.ac, [[AC_INIT(Test, 1.0) AC_CANONICAL_SYSTEM -dnl The doc says 27 is a valid fubar. +# The doc says 27 is a valid fubar. fubar=27 AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar) ]]) @@ -472,7 +474,7 @@ AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar) AT_DATA([expout], [[AC_INIT([Test],[1.0]) AC_CANONICAL_TARGET([]) -dnl The doc says 27 is a valid fubar. +# The doc says 27 is a valid fubar. fubar=27 AC_CONFIG_FILES([Makefile]) AC_CONFIG_COMMANDS([default],[[echo $fubar]],[[fubar=$fubar]]) diff --git a/tests/torture.at b/tests/torture.at index 700ac9d8..9c795c7c 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -348,6 +348,9 @@ AT_CLEANUP ## in config.status. sed is used to skip the first two lines ## `Generated by...'. +# We use m4_for many times. +m4_pattern_allow([^m4_for$]) + AT_SETUP([Torturing config.status]) dnl The value used as a big value for AC_DEFINE. @@ -370,6 +373,7 @@ m4_define([AT_DESCRIPTION], # turned into ac_uummy during the construction of config.status. Yes, # this is admittedly a bug, but it would be too hard to fix this. # There is really no point in AC_DEFINE a var named ac_d.*. +m4_pattern_allow([^m4_patsubst$]) m4_define([AT_DUMMY_VAR], [ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])]) @@ -385,7 +389,7 @@ AT_DATA([dummy.in], # configure.ac # # ------------ # -AT_DATA(configure.ac, +AT_DATA([configure.ac], dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc. [[m4_define([AC_DUMMY_VAR],]