* 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 <akim@epita.fr>
+
+ 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 <akim@epita.fr>
Let M4sh have its own diversions.
# 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
# -------
# 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}
$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])
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
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])
[REQUIRE_AND_CHECK([TEST2a])
test3=set])
-AC_PLAIN_SCRIPT()dnl
+AC_PLAIN_SCRIPT()
#! /bin/sh
TEST1
AC_DEFUN_ONCE([SINGLE_TEST],
[single_test=".$single_test"])
-AC_PLAIN_SCRIPT()dnl
+AC_PLAIN_SCRIPT()
#! /bin/sh
TEST
AC_DEFUN_ONCE([SINGLE_TEST],
[single_test=".$single_test"])
-AC_PLAIN_SCRIPT()dnl
+AC_PLAIN_SCRIPT()
#! /bin/sh
MULTI_TEST
AC_DEFUN([INNER_TEST],
[inner_test=".$inner_test"])
-AC_PLAIN_SCRIPT()dnl
+AC_PLAIN_SCRIPT()
#! /bin/sh
AC_PROVIDE([INNER_TEST])
# 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
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)
]])
## ------------ ##
# 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`
AT_SETUP([Negated classes in globbing])
AT_DATA([configure.ac],
-[[AC_PLAIN_SCRIPT()dnl
+[[AC_PLAIN_SCRIPT()
#! /bin/sh
case 'with!two!bangs' in
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
-AT_CLEANUP(configure)
+AT_CLEANUP
## m4_warn. ##
## --------- ##
+m4_pattern_allow([^m4_warn$])
AT_SETUP([[m4_warn]])
# m4_text_wrap is used to display the help strings. Also, check that
## 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
## 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
# 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)
# -----------------------------
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($@))])
# ---------------------------------
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
B_AC_FOO
AS_FOO
_AS_BAR
-[dnl]
+[d@__@nl]
]])
AT_CHECK_AUTOCONF([], 1, [],
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
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.
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)
]])
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]])
## 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.
# 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])])
# 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],]