Check that updated scripts are valid scripts.

* tests/mktests.sh: Generate `syntax.m4' directly.
* tests/macros.m4: Remove.
Adjust dependencies.
* tests/mktests.sh: Generate `update.m4' too.
* tests/update.m4: New generated file.
Adjust dependencies.
* tests/atspecific.m4 (AT_CHECK_UPDATE): New macro.
This commit is contained in:
Akim Demaille 2000-10-05 13:52:41 +00:00
parent fe9214cbf0
commit aed9b5dee4
8 changed files with 286 additions and 54 deletions

View File

@ -1,3 +1,15 @@
2000-10-05 Akim Demaille <akim@epita.fr>
Check that updated scripts are valid scripts.
* tests/mktests.sh: Generate `syntax.m4' directly.
* tests/macros.m4: Remove.
Adjust dependencies.
* tests/mktests.sh: Generate `update.m4' too.
* tests/update.m4: New generated file.
Adjust dependencies.
* tests/atspecific.m4 (AT_CHECK_UPDATE): New macro.
2000-10-05 Akim Demaille <akim@epita.fr>
* tests/mktests.sh: New file, which replaces the code inlined in

View File

@ -20,18 +20,17 @@
AUTOMAKE_OPTIONS = gnits
SUITE = torture.m4 semantics.m4 syntax.m4 base.m4 tools.m4
SUITE = base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4
# We don't actually distribute the testsuite, since one only
# needs m4 to build it, m4 being required anyway to install Autoconf.
EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 macros.m4 aclocal.m4 \
$(SUITE) \
mktests.sh
EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 aclocal.m4 \
$(SUITE) mktests.sh
check-local: atconfig testsuite
$(SHELL) testsuite
testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE)
testsuite: atgeneral.m4 atspecific.m4 suite.m4 $(SUITE)
$(M4) -I $(srcdir) atspecific.m4 suite.m4 | \
sed -e 's/[ ]*$$//' | \
sed -e '/^$$/N;/\n$$/D' > $@-tmp
@ -43,8 +42,11 @@ testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE)
MACRO_FILES = $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 \
$(top_srcdir)/acfunctions.m4 $(top_srcdir)/aclang.m4
macros.m4: $(MACRO_FILES) $(srcdir)/Makefile.am
./mktests.sh $@ $(MACRO_FILES)
syntax.m4: mktests.sh $(MACRO_FILES)
./mktests.sh $(MACRO_FILES)
update.m4: mktests.sh $(MACRO_FILES)
./mktests.sh $(MACRO_FILES)
CLEANFILES = debug-*.sh macro configure configure.in config.status \
config.cache config.log config.h.in config.h

View File

@ -60,20 +60,19 @@ POST_UNINSTALL = :
AWK = @AWK@
HELP2MAN = @HELP2MAN@
M4 = @M4@
PERL = @PERL@
PERLSCRIPTS = @PERLSCRIPTS@
standards_texi = @standards_texi@
AUTOMAKE_OPTIONS = gnits
SUITE = torture.m4 semantics.m4 syntax.m4 base.m4 tools.m4
SUITE = base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4
# We don't actually distribute the testsuite, since one only
# needs m4 to build it, m4 being required anyway to install Autoconf.
EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 macros.m4 aclocal.m4 $(SUITE) mktests.sh
EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 aclocal.m4 $(SUITE) mktests.sh
PERL = perl
# The files which contains macro we check for syntax.
MACRO_FILES = $(top_srcdir)/acgeneral.m4 $(top_srcdir)/acspecific.m4 $(top_srcdir)/acfunctions.m4 $(top_srcdir)/aclang.m4
@ -83,7 +82,7 @@ CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache
DISTCLEANFILES = atconfig testsuite
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES = atconfig
DIST_COMMON = Makefile.am Makefile.in atconfig.in
DIST_COMMON = Makefile.am Makefile.in atconfig.in configure.in
PACKAGE = @PACKAGE@
@ -195,15 +194,18 @@ mostlyclean distclean maintainer-clean
check-local: atconfig testsuite
$(SHELL) testsuite
testsuite: atgeneral.m4 atspecific.m4 suite.m4 macros.m4 $(SUITE)
testsuite: atgeneral.m4 atspecific.m4 suite.m4 $(SUITE)
$(M4) -I $(srcdir) atspecific.m4 suite.m4 | \
sed -e 's/[ ]*$$//' | \
sed -e '/^$$/N;/\n$$/D' > $@-tmp
chmod +x $@-tmp
mv $@-tmp $@
macros.m4: $(MACRO_FILES) $(srcdir)/Makefile.am
./mktests.sh $@ $(MACRO_FILES)
syntax.m4: mktests.sh $(MACRO_FILES)
./mktests.sh $(MACRO_FILES)
update.m4: mktests.sh $(MACRO_FILES)
./mktests.sh $(MACRO_FILES)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -72,8 +72,8 @@ define(_m4_foreach,
## ---------------------------------------- ##
# _AT_CHECK_AC_MACRO(AC-BODY)
# ---------------------------
# _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS)
# --------------------------------------
# Create a minimalist configure.in running the macro named
# NAME-OF-THE-MACRO, check that autoconf runs on that script,
# and that the shell runs correctly the configure.
@ -90,7 +90,7 @@ $1
AC_ENV_SAVE(env-after)
AC_OUTPUT
])
$2
AT_CHECK([autoconf -W none --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([top_srcdir=$top_srcdir ./configure], 0, ignore, [])
@ -120,6 +120,25 @@ AT_CLEANUP(configure config.status config.log config.cache config.hin config.h e
])# AT_CHECK_MACRO
# AT_CHECK_UPDATE(NAME-OF-THE-MACRO)
# ----------------------------------
# Create a minimalist configure.in running the macro named
# NAME-OF-THE-MACRO, autoupdate this script, check that autoconf runs
# on that script, and that the shell runs correctly the configure.
# TOP_SRCDIR is needed to set the auxdir (some macros need
# `install-sh', `config.guess' etc.).
AT_DEFINE([AT_CHECK_UPDATE],
[AT_SETUP([$1])
_AT_CHECK_AC_MACRO([$1],
[AT_CHECK([autoupdate --autoconf-dir ..], 0,
[], [autoupdate: `configure.in' is updated
])])
AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
])# AT_CHECK_UPDATE
# AT_CHECK_DEFINES(CONTENT)
# -------------------------
# Verify that config.h, once stripped is CONTENT.

View File

@ -1,7 +1,6 @@
#! /bin/sh
# Build some of the Autoconf test files.
# Copyright (C) 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@ -19,12 +18,15 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
dst=$1
shift
src="$@"
# filter_macros_list
# ------------------
# --------- #
# syntax.m4 #
# --------- #
# syntax_exclude_list
# -------------------
# The test `syntax.m4' tries to run all the macros of Autoconf to check
# for syntax problems, etc. Not all the macros can be run without argument,
# and some are already tested elsewhere. EGREP_EXCLUDE must filter out
@ -56,7 +58,7 @@ src="$@"
# Checked in semantics.
# - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT
# AU defined to nothing.
filter_macros_list='^AC_ARG_VAR$
syntax_exclude_list='^AC_ARG_VAR$
^AC_CANONICALIZE$
^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
^AC_CONFIG
@ -78,43 +80,93 @@ filter_macros_list='^AC_ARG_VAR$
^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$
_AC_'
# filter_macros_egrep --
# syntax_exclude_egrep --
# Build a single egrep pattern out of filter_macros_list.
# Sed is used to get rid of the trailing `|' coming from the trailing
# `\n' from `echo'.
filter_macros_egrep=`echo "$filter_macros_list" | tr '
syntax_exclude_egrep=`echo "$syntax_exclude_list" | tr '
' '|' | sed 's/.$//'`
sed 's/^ *//' >syntax.tm4 <<MK_EOF
# Generated by mktests.sh, do not edit by hand. -*- autoconf -*-
cat <<EOF
Syntax of macros and completeness of header templates.
EOF
MK_EOF
# Get the list of macros which are defined in Autoconf level.
# Get rid of the macros we are not interested in.
cat $src |
sed -ne 's/^A[CU]_DEFUN\(_ONCE\)\?(\[*\([a-zA-Z0-9_]*\).*$/\2/p' |
sort |
uniq |
egrep -v "$syntax_exclude_egrep" >acdefuns
# Get the list of macros that are required: there is little interest
# in testing them since they will be run but the guy who requires
# them.
cat $src |
sed -ne 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
sort |
uniq >requires
# Filter out.
for macro in `cat acdefuns`; do
if fgrep "$macro" requires >/dev/null 2>&1; then :; else
echo "AT_CHECK_MACRO([$macro])" >>syntax.tm4
fi
done
mv syntax.tm4 syntax.m4
# --------- #
# update.m4 #
# --------- #
# update_exclude_list
# -------------------
# AC_LANG_RESTORE alone cannot be used.
update_exclude_list='^AC_LANG_RESTORE$'
# syntax_exclude_egrep --
# Build a single egrep pattern out of filter_macros_list.
# Sed is used to get rid of the trailing `|' coming from the trailing
# `\n' from `echo'.
update_exclude_egrep=`echo "$update_exclude_list" | tr '
' '|' | sed 's/.$//'`
case $dst in
*macros.m4)
# Get the list of macros which are defined in Autoconf level.
# Get rid of the macros we are not interested in.
cat $src | \
sed -ne 's/^A[CU]_DEFUN\(_ONCE\)\?(\[*\([a-zA-Z0-9_]*\).*$/\2/p' | \
sort | uniq | egrep -v "$filter_macros_egrep" >defuns
sed 's/^ *//' >update.tm4 <<MK_EOF
# Generated by mktests.sh, do not edit by hand. -*- autoconf -*-
# Get the list of macros that are required: there is little interest
# in testing them since they will be run but the guy who requires
# them.
cat $src | \
sed -ne 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' | \
sort | uniq >requires
cat <<EOF
# Filter out.
for macro in `cat defuns`; do \
if fgrep "$macro" requires >/dev/null 2>&1; then :; else \
echo "AT_CHECK_MACRO([$macro])" >>$dst-t; \
fi; \
done
Checking that autoupdated configure.in are sane.
rm defuns requires
mv $dst-t $dst
;;
Four of these tests will fail, we know that, and we are working on it.
Please, don't consider them.
*)
echo "$0: don't know how to do $src" >&2
exit 1
esac
EOF
MK_EOF
# Get the list of macros which are defined in Autoupdate level.
cat $src |
sed -ne 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' |
sort |
uniq |
egrep -v "$update_exclude_egrep" |
sed 's/.*/AT_CHECK_UPDATE([&])/' >>update.tm4
mv update.tm4 update.m4
# rm -f acdefuns audefuns requires
exit 0

View File

@ -31,3 +31,6 @@ AT_INCLUDE(torture.m4)
# Checking all the AC_DEFUN'd macros.
AT_INCLUDE(syntax.m4)
# Checking that updatiing an obsolete macro produces a valid configure.in
AT_INCLUDE(update.m4)

View File

@ -1,4 +1,4 @@
# -*- autoconf -*-
# Generated by mktests.sh, do not edit by hand. -*- autoconf -*-
cat <<EOF
@ -6,4 +6,98 @@ Syntax of macros and completeness of header templates.
EOF
AT_INCLUDE(macros.m4)
AT_CHECK_MACRO([AC_AIX])
AT_CHECK_MACRO([AC_ARG_ARRAY])
AT_CHECK_MACRO([AC_ARG_ENABLE])
AT_CHECK_MACRO([AC_ARG_PROGRAM])
AT_CHECK_MACRO([AC_ARG_WITH])
AT_CHECK_MACRO([AC_CANONICAL_TARGET])
AT_CHECK_MACRO([AC_C_BIGENDIAN])
AT_CHECK_MACRO([AC_C_CHAR_UNSIGNED])
AT_CHECK_MACRO([AC_C_CROSS])
AT_CHECK_MACRO([AC_CHECK_TOOL_PREFIX])
AT_CHECK_MACRO([AC_C_LONG_DOUBLE])
AT_CHECK_MACRO([AC_COMPILE_CHECK])
AT_CHECK_MACRO([AC_C_PROTOTYPES])
AT_CHECK_MACRO([AC_C_STRINGIZE])
AT_CHECK_MACRO([AC_DECL_SYS_SIGLIST])
AT_CHECK_MACRO([AC_DECL_YYTEXT])
AT_CHECK_MACRO([AC_DIR_HEADER])
AT_CHECK_MACRO([AC_DYNIX_SEQ])
AT_CHECK_MACRO([AC_EGREP_CPP])
AT_CHECK_MACRO([AC_EGREP_HEADER])
AT_CHECK_MACRO([AC_ENABLE])
AT_CHECK_MACRO([AC_F77_WRAPPERS])
AT_CHECK_MACRO([AC_FUNC_ALLOCA])
AT_CHECK_MACRO([AC_FUNC_CHOWN])
AT_CHECK_MACRO([AC_FUNC_CLOSEDIR_VOID])
AT_CHECK_MACRO([AC_FUNC_ERROR_AT_LINE])
AT_CHECK_MACRO([AC_FUNC_FNMATCH])
AT_CHECK_MACRO([AC_FUNC_GETGROUPS])
AT_CHECK_MACRO([AC_FUNC_GETLOADAVG])
AT_CHECK_MACRO([AC_FUNC_GETMNTENT])
AT_CHECK_MACRO([AC_FUNC_GETPGRP])
AT_CHECK_MACRO([AC_FUNC_MALLOC])
AT_CHECK_MACRO([AC_FUNC_MEMCMP])
AT_CHECK_MACRO([AC_FUNC_MKTIME])
AT_CHECK_MACRO([AC_FUNC_MMAP])
AT_CHECK_MACRO([AC_FUNC_OBSTACK])
AT_CHECK_MACRO([AC_FUNC_SELECT_ARGTYPES])
AT_CHECK_MACRO([AC_FUNC_SETPGRP])
AT_CHECK_MACRO([AC_FUNC_SETVBUF_REVERSED])
AT_CHECK_MACRO([AC_FUNC_STAT])
AT_CHECK_MACRO([AC_FUNC_STRCOLL])
AT_CHECK_MACRO([AC_FUNC_STRERROR_R])
AT_CHECK_MACRO([AC_FUNC_STRFTIME])
AT_CHECK_MACRO([AC_FUNC_STRTOD])
AT_CHECK_MACRO([AC_FUNC_UTIME_NULL])
AT_CHECK_MACRO([AC_FUNC_VFORK])
AT_CHECK_MACRO([AC_FUNC_VPRINTF])
AT_CHECK_MACRO([AC_FUNC_WAIT3])
AT_CHECK_MACRO([AC_HAVE_LIBRARY])
AT_CHECK_MACRO([AC_HAVE_POUNDBANG])
AT_CHECK_MACRO([AC_HEADER_MAJOR])
AT_CHECK_MACRO([AC_HEADER_STAT])
AT_CHECK_MACRO([AC_HEADER_TIOCGWINSZ])
AT_CHECK_MACRO([AC_INT_16_BITS])
AT_CHECK_MACRO([AC_IRIX_SUN])
AT_CHECK_MACRO([AC_ISC_POSIX])
AT_CHECK_MACRO([AC_LONG_64_BITS])
AT_CHECK_MACRO([AC_MEMORY_H])
AT_CHECK_MACRO([AC_MINGW32])
AT_CHECK_MACRO([AC_MINIX])
AT_CHECK_MACRO([AC_NO_EXECUTABLES])
AT_CHECK_MACRO([AC_OUTPUT_COMMANDS])
AT_CHECK_MACRO([AC_PATH_XTRA])
AT_CHECK_MACRO([AC_PREFIX_DEFAULT])
AT_CHECK_MACRO([AC_PROG_AWK])
AT_CHECK_MACRO([AC_PROG_CC_C_O])
AT_CHECK_MACRO([AC_PROG_F77_C_O])
AT_CHECK_MACRO([AC_PROG_GCC_TRADITIONAL])
AT_CHECK_MACRO([AC_PROG_INSTALL])
AT_CHECK_MACRO([AC_PROG_LEX])
AT_CHECK_MACRO([AC_PROG_LN_S])
AT_CHECK_MACRO([AC_PROG_MAKE_SET])
AT_CHECK_MACRO([AC_PROG_RANLIB])
AT_CHECK_MACRO([AC_PROG_YACC])
AT_CHECK_MACRO([AC_REQUIRE_CPP])
AT_CHECK_MACRO([AC_RSH])
AT_CHECK_MACRO([AC_SCO_INTL])
AT_CHECK_MACRO([AC_STRUCT_ST_BLKSIZE])
AT_CHECK_MACRO([AC_STRUCT_ST_BLOCKS])
AT_CHECK_MACRO([AC_STRUCT_ST_RDEV])
AT_CHECK_MACRO([AC_STRUCT_TIMEZONE])
AT_CHECK_MACRO([AC_SYS_INTERPRETER])
AT_CHECK_MACRO([AC_SYS_LARGEFILE])
AT_CHECK_MACRO([AC_SYS_LONG_FILE_NAMES])
AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS])
AT_CHECK_MACRO([AC_TYPE_MODE_T])
AT_CHECK_MACRO([AC_TYPE_OFF_T])
AT_CHECK_MACRO([AC_TYPE_SIGNAL])
AT_CHECK_MACRO([AC_UNISTD_H])
AT_CHECK_MACRO([AC_USG])
AT_CHECK_MACRO([AC_VALIDATE_CACHED_SYSTEM_TUPLE])
AT_CHECK_MACRO([AC_WITH])
AT_CHECK_MACRO([AC_XENIX_DIR])
AT_CHECK_MACRO([AM_TYPE_PTRDIFF_T])

48
tests/update.m4 Normal file
View File

@ -0,0 +1,48 @@
# Generated by mktests.sh, do not edit by hand. -*- autoconf -*-
cat <<EOF
Checking that autoupdated configure.in are sane.
Four of these tests will fail, we know that, and we are working on it.
Please, don't consider them.
EOF
AT_CHECK_UPDATE([AC_ARG_ARRAY])
AT_CHECK_UPDATE([AC_CHECK_TOOL_PREFIX])
AT_CHECK_UPDATE([AC_COMPILE_CHECK])
AT_CHECK_UPDATE([AC_CYGWIN])
AT_CHECK_UPDATE([AC_CYGWIN32])
AT_CHECK_UPDATE([AC_DECL_YYTEXT])
AT_CHECK_UPDATE([AC_DIR_HEADER])
AT_CHECK_UPDATE([AC_DYNIX_SEQ])
AT_CHECK_UPDATE([AC_EMXOS2])
AT_CHECK_UPDATE([AC_ENABLE])
AT_CHECK_UPDATE([AC_F77_NAME_MANGLING])
AT_CHECK_UPDATE([AC_HAVE_LIBRARY])
AT_CHECK_UPDATE([AC_HAVE_POUNDBANG])
AT_CHECK_UPDATE([AC_INIT])
AT_CHECK_UPDATE([AC_INT_16_BITS])
AT_CHECK_UPDATE([AC_IRIX_SUN])
AT_CHECK_UPDATE([AC_LANG_C])
AT_CHECK_UPDATE([AC_LANG_CPLUSPLUS])
AT_CHECK_UPDATE([AC_LANG_FORTRAN77])
AT_CHECK_UPDATE([AC_LANG_SAVE])
AT_CHECK_UPDATE([AC_LINK_FILES])
AT_CHECK_UPDATE([AC_LONG_64_BITS])
AT_CHECK_UPDATE([AC_MEMORY_H])
AT_CHECK_UPDATE([AC_MINGW32])
AT_CHECK_UPDATE([AC_OUTPUT])
AT_CHECK_UPDATE([AC_OUTPUT_COMMANDS])
AT_CHECK_UPDATE([AC_RSH])
AT_CHECK_UPDATE([AC_SCO_INTL])
AT_CHECK_UPDATE([AC_STRUCT_ST_BLKSIZE])
AT_CHECK_UPDATE([AC_STRUCT_ST_RDEV])
AT_CHECK_UPDATE([AC_UNISTD_H])
AT_CHECK_UPDATE([AC_USG])
AT_CHECK_UPDATE([AC_VALIDATE_CACHED_SYSTEM_TUPLE])
AT_CHECK_UPDATE([AC_WITH])
AT_CHECK_UPDATE([AC_XENIX_DIR])
AT_CHECK_UPDATE([AM_TYPE_PTRDIFF_T])