Reorder the test suite so that low level features are tested

before high level ones.
* tests/semantics.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
(missing templates): Move to...
* tests/torture.at: here.
Reorder the file so that the torture test is last.
* tests/semantics.at (AC_TRY_LINK_FUNC, AC_PROG_CPP with warnings)
(AC_PROG_CPP without warnings): Move to...
* tests/compile.at: here, new file.
* tests/suite.at: Run `torture' and then `compile' before
`semantics'.
This commit is contained in:
Akim Demaille 2000-11-16 14:56:17 +00:00
parent eb0f047bb5
commit f4ab635fa6
7 changed files with 284 additions and 159 deletions

View File

@ -1,3 +1,18 @@
2000-11-16 Akim Demaille <akim@epita.fr>
Reorder the test suite so that low level features are tested
before high level ones.
* tests/semantics.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
(missing templates): Move to...
* tests/torture.at: here.
Reorder the file so that the torture test is last.
* tests/semantics.at (AC_TRY_LINK_FUNC, AC_PROG_CPP with warnings)
(AC_PROG_CPP without warnings): Move to...
* tests/compile.at: here, new file.
* tests/suite.at: Run `torture' and then `compile' before
`semantics'.
2000-11-16 Akim Demaille <akim@epita.fr>
* acspecific.m4 (AC_SYS_LARGEFILE): _AC_SYS_LARGEFILE_SOURCE no

View File

@ -22,7 +22,7 @@ AUTOMAKE_OPTIONS = gnits
SUITE = suite.at \
m4sugar.at m4sh.at \
base.at tools.at semantics.at torture.at syntax.at update.at
base.at tools.at torture.at compile.at semantics.at syntax.at update.at
# We don't actually distribute the testsuite, since one only
# needs m4 to build it, m4 being required anyway to install Autoconf.

View File

@ -66,7 +66,7 @@ standards_texi = @standards_texi@
AUTOMAKE_OPTIONS = gnits
SUITE = suite.at m4sugar.at m4sh.at base.at tools.at semantics.at torture.at syntax.at update.at
SUITE = suite.at m4sugar.at m4sh.at base.at tools.at compile.at semantics.at torture.at syntax.at update.at
# We don't actually distribute the testsuite, since one only

105
tests/compile.at Normal file
View File

@ -0,0 +1,105 @@
# -*- autoconf -*-
cat <<EOF
Low level compiling/preprocessing macros.
EOF
# Since the macros which compile are required by most tests, check
# them first. But remember that looking for a compiler is even more
# primitive, so check those first.
## ------------ ##
## C keywords. ##
## ------------ ##
# GCC supports `const', `volatile', and `inline'.
AT_CHECK_MACRO([C keywords],
[[AC_PROG_CC
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
case "$GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile" in
yes,*no*)
AC_MSG_ERROR([failed to detect `const', `inline' or `volatile' support]);;
esac]])
## --------------------------- ##
## AC_PROG_CPP with warnings. ##
## --------------------------- ##
# It's Ok for strict preprocessors to produce warnings.
AT_SETUP([AC_PROG_CPP with warnings])
AT_DATA([mycpp],
[[#! /bin/sh
echo noise >&2
exec ${1+"$@"}
]])
chmod +x mycpp
_AT_CHECK_AC_MACRO(
[AC_PROG_CPP
# If the preprocessor is not strict, just ignore
test "x$ac_c_preproc_warn_flag" = xyes &&
AC_MSG_ERROR([preprocessor has no warning option], 77)
CPP="./mycpp $CPP"
AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
AT_CHECK_DEFINES(
[/* #undef HAVE_AUTOCONF_IO_H */
#define HAVE_STDIO_H 1
])
AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
## ------------------------------ ##
## AC_PROG_CPP without warnings. ##
## ------------------------------ ##
AT_SETUP([AC_PROG_CPP without warnings])
AT_DATA([mycpp],
[[#! /bin/sh
/lib/cpp ${1+"$@"}
exit 0
]])
chmod +x mycpp
_AT_CHECK_AC_MACRO(
[# Ignore if /lib/cpp doesn't work
/lib/cpp </dev/null >/dev/null 2>&1 ||
AC_MSG_ERROR([preprocessor doesn't work], 77)
CPP=./mycpp
AC_PROG_CPP
test "x$ac_c_preproc_warn_flag" != xyes &&
AC_MSG_ERROR([failed to detect preprocessor warning option])
AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
AT_CHECK_DEFINES(
[/* #undef HAVE_AUTOCONF_IO_H */
#define HAVE_STDIO_H 1
])
AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
## ------------------ ##
## AC_TRY_LINK_FUNC. ##
## ------------------ ##
AT_CHECK_MACRO([AC_TRY_LINK_FUNC],
[AC_TRY_LINK_FUNC(exit,,
[AC_MSG_ERROR([cannot find `exit'])])
AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
[AC_MSG_ERROR([found a nonexistent function])])])

View File

@ -400,74 +400,3 @@ AT_CHECK_DEFINES(
])
AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
## ------------- ##
## Base macros. ##
## ------------- ##
AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
AT_DATA(configure.in,
[[AC_INIT
rm -rf header file link command
touch header.in file.in link.in command.in
case $what_to_test in
header) AC_CONFIG_HEADERS(header:header.in);;
file) AC_CONFIG_FILES(file:file.in);;
command) AC_CONFIG_COMMANDS(command:command.in, [cp command.in command]);;
link) AC_CONFIG_LINKS(link:link.in);;
esac
AC_OUTPUT
]])
AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
# Create a header
AT_CHECK([./configure what_to_test=header], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [header
])
# Create a file
AT_CHECK([./configure what_to_test=file], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [file
])
# Execute a command
AT_CHECK([./configure what_to_test=command], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [command
])
# Create a link
AT_CHECK([./configure what_to_test=link], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [link
])
AT_CLEANUP(header file link command header.in file.in link.in command.in configure config.status)
## ------------------------------------------------------ ##
## Check that config.status detects missing input files. ##
## ------------------------------------------------------ ##
AT_SETUP([missing templates])
AT_DATA(configure.in,
[[AC_INIT
AC_CONFIG_FILES([nonexistent])
AC_OUTPUT
]])
AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([./configure], 1, ignore,
[[config.status: error: cannot find input file `nonexistent.in'
]])
# Make sure that the output file doesn't exist
AT_CHECK([test -f nonexistent], 1)
AT_CLEANUP(configure config.status config.log config.cache config.h defs)

View File

@ -8,7 +8,7 @@
# like contributing new tests? If you do, you may tell your intent to
# `autoconf@gnu.org', so no two people work at the same thing.
AT_INIT(autoconf)
AT_INIT([autoconf])
cat <<EOF
Some tests might be ignored if you don't have the software which the
@ -19,25 +19,32 @@ EOF
# the most selective to the easiest.
# M4sugar.
AT_INCLUDE(m4sugar.at)
AT_INCLUDE([m4sugar.at])
# M4sh.m4.
AT_INCLUDE(m4sh.at)
AT_INCLUDE([m4sh.at])
# Autoconf base macros.
AT_INCLUDE(base.at)
AT_INCLUDE([base.at])
# The executables.
AT_INCLUDE(tools.at)
AT_INCLUDE([tools.at])
# Testing config.status
# ---------------------
# Actually should be named config.status.at but I fear problems with
# the name. Does no `checking...' at all, but exercises only code
# which following section use too. Hence, run it first.
AT_INCLUDE([torture.at])
# Checking AC_PROG_CC, AC_COMPILE_IFELSE etc.
AT_INCLUDE([compile.at])
# Checking that AC_CHECK_FOO macros work properly.
AT_INCLUDE(semantics.at)
# Stressing config.status.
AT_INCLUDE(torture.at)
AT_INCLUDE([semantics.at])
# Checking all the AC_DEFUN'd macros.
AT_INCLUDE(syntax.at)
AT_INCLUDE([syntax.at])
# Checking that updatiing an obsolete macro produces a valid configure.in
AT_INCLUDE(update.at)
# Checking that updating an obsolete macro produces a valid configure.in
AT_INCLUDE([update.at])

View File

@ -2,7 +2,7 @@
cat <<\EOF
Torturing config.status.
Testing config.status.
## ---------------------------------------------------------------- ##
## This section of torture tests is trying to make Autoconf produce ##
@ -13,88 +13,73 @@ Torturing config.status.
EOF
dnl The value used as a big value for AC_DEFINE.
dnl Don't use sh active chars here, below it is also used in a sh
dnl assignment.
define(Big_Value,
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
define(DEFINE_Description,
[Define to a long string if your `Autoconf' works properly.])
## ---------------------------------------------- ##
## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
## ---------------------------------------------- ##
# AT_DUMMY_VAR(NUMBER)
# --------------------
# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
# so that the check for user name space invasion does not complain
# of the new variables defined.
#
# Note that you should not use the name ac_dummy, because it will be
# 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.*.
define(AT_DUMMY_VAR,
[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
dnl This call was quite delicate to write because we didn't want to
dnl produce the 100 commands by hand. Be very careful if you want to
dnl touch something.
## ------------------------- ##
## Torturing config.status. ##
## ------------------------- ##
## Require 100 AC_DEFINE and AC_SUBST with a significantly big value.
## This is mostly to check that Autoconf produces portable sed scripts
## in config.status. sed is used to skip the first two lines
## `Generated by...'.
AT_SETUP(config.status under extreme conditions)
AT_DATA(dummy.in,
[m4_for(AT_Count, 1, 100,
[@AT_DUMMY_VAR(AT_Count)@
])])
AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
AT_DATA(configure.in,
[AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AC_CONFIG_FILES(dummy)
[define]([AC_DEFUBST_VALUE], Big_Value)
dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
dnl to AC_DUMMY_VAR in Autoconf.
[define]([AC_DUMMY_VAR],
changequote({{, }})dnl
[defn({{AT_DUMMY_VAR}})]dnl
changequote([, ]))
m4_for(AT_Count, 1, 100,
[AC_DEFUBST(AT_Count)
])
[[AC_INIT
rm -rf header file link command
touch header.in file.in link.in command.in
case $what_to_test in
header) AC_CONFIG_HEADERS(header:header.in);;
file) AC_CONFIG_FILES(file:file.in);;
command) AC_CONFIG_COMMANDS(command:command.in, [cp command.in command]);;
link) AC_CONFIG_LINKS(link:link.in);;
esac
AC_OUTPUT
])
]])
AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([../autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([./configure], 0, ignore)
# Checking that AC_DEFINE worked properly.
AT_DATA(expout,
[m4_for(AT_Count, 1, 100,
[
/* DEFINE_Description */
[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
])])
AT_CHECK([sed -n -e '3,$ p' config.h], 0, expout)
# Create a header
AT_CHECK([./configure what_to_test=header], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [header
])
# Checking that AC_SUBST worked properly.
AT_DATA(expout,
[m4_for(AT_Count, 1, 100,
[Big_Value
])])
# Create a file
AT_CHECK([./configure what_to_test=file], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [file
])
# Execute a command
AT_CHECK([./configure what_to_test=command], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [command
])
# Create a link
AT_CHECK([./configure what_to_test=link], 0, ignore)
AT_CHECK([ls header file command link 2>/dev/null], [], [link
])
AT_CLEANUP(header file link command header.in file.in link.in command.in configure config.status)
## ------------------------------------------------------ ##
## Check that config.status detects missing input files. ##
## ------------------------------------------------------ ##
AT_SETUP([missing templates])
AT_DATA(configure.in,
[[AC_INIT
AC_CONFIG_FILES([nonexistent])
AC_OUTPUT
]])
AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([./configure], 1, ignore,
[[config.status: error: cannot find input file `nonexistent.in'
]])
# Make sure that the output file doesn't exist
AT_CHECK([test -f nonexistent], 1)
AT_CLEANUP(configure config.status config.log config.cache config.h defs)
AT_CLEANUP(dummy)
@ -108,7 +93,7 @@ AT_CLEANUP(dummy)
# (ii) correctly passes them to `config.status', which we check by
# running `config.status --recheck'.
AT_SETUP(command line interface)
AT_SETUP([command line interface])
AT_DATA(configure.in,
[[AC_INIT
@ -212,3 +197,87 @@ AT_DATA(expout,
AT_CHECK([sed -e 's/ $//' defs], 0, expout)
AT_CLEANUP(configure config.status config.log config.cache config.h defs)
## ------------------------- ##
## Torturing config.status. ##
## ------------------------- ##
## Require 100 AC_DEFINE and AC_SUBST with a significantly big value.
## This is mostly to check that Autoconf produces portable sed scripts
## in config.status. sed is used to skip the first two lines
## `Generated by...'.
dnl The value used as a big value for AC_DEFINE.
dnl Don't use sh active chars here, below it is also used in a sh
dnl assignment.
define([Big_Value],
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
define([DEFINE_Description],
[Define to a long string if your `Autoconf' works properly.])
# AT_DUMMY_VAR(NUMBER)
# --------------------
# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
# so that the check for user name space invasion does not complain
# of the new variables defined.
#
# Note that you should not use the name ac_dummy, because it will be
# 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.*.
define([AT_DUMMY_VAR],
[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
dnl This call was quite delicate to write because we didn't want to
dnl produce the 100 commands by hand. Be very careful if you want to
dnl touch something.
AT_SETUP([Torturing config.status])
AT_DATA(dummy.in,
[m4_for(AT_Count, 1, 100,
[@AT_DUMMY_VAR(AT_Count)@
])])
AT_DATA(configure.in,
[AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AC_CONFIG_FILES(dummy)
[define]([AC_DEFUBST_VALUE], Big_Value)
dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
dnl to AC_DUMMY_VAR in Autoconf.
[define]([AC_DUMMY_VAR],
changequote({{, }})dnl
[defn({{AT_DUMMY_VAR}})]dnl
changequote([, ]))
m4_for(AT_Count, 1, 100,
[AC_DEFUBST(AT_Count)
])
AC_OUTPUT
])
AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([../autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
AT_CHECK([./configure], 0, ignore)
# Checking that AC_DEFINE worked properly.
AT_DATA(expout,
[m4_for(AT_Count, 1, 100,
[
/* DEFINE_Description */
[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
])])
AT_CHECK([sed -n -e '3,$ p' config.h], 0, expout)
# Checking that AC_SUBST worked properly.
AT_DATA(expout,
[m4_for(AT_Count, 1, 100,
[Big_Value
])])
AT_CLEANUP(dummy)