From: Akim Demaille Date: Thu, 16 Nov 2000 14:56:17 +0000 (+0000) Subject: Reorder the test suite so that low level features are tested X-Git-Tag: autoconf-2.50~414 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4ab635fa6a0dbc6c774b53ee6cbf39075d113c6;p=thirdparty%2Fautoconf.git 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'. --- diff --git a/ChangeLog b/ChangeLog index 6f9c40dc9..fe27f19f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2000-11-16 Akim Demaille + + 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 * acspecific.m4 (AC_SYS_LARGEFILE): _AC_SYS_LARGEFILE_SOURCE no diff --git a/tests/Makefile.am b/tests/Makefile.am index 1e89017b4..434dd8d18 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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. diff --git a/tests/Makefile.in b/tests/Makefile.in index 2fcdb5ab3..0f03f1280 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 diff --git a/tests/compile.at b/tests/compile.at new file mode 100644 index 000000000..7f934703d --- /dev/null +++ b/tests/compile.at @@ -0,0 +1,105 @@ +# -*- autoconf -*- + +cat <&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 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])])]) diff --git a/tests/semantics.at b/tests/semantics.at index ca005d447..946cd308b 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -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) diff --git a/tests/suite.at b/tests/suite.at index 75c9c3e1b..3fbc03a6b 100644 --- a/tests/suite.at +++ b/tests/suite.at @@ -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 </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 +]) -## ------------------------- ## -## Torturing config.status. ## -## ------------------------- ## +# Execute a command +AT_CHECK([./configure what_to_test=command], 0, ignore) +AT_CHECK([ls header file command link 2>/dev/null], [], [command +]) -## 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...'. +# 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) -AT_SETUP(config.status under extreme conditions) -AT_DATA(dummy.in, -[m4_for(AT_Count, 1, 100, -[@AT_DUMMY_VAR(AT_Count)@ -])]) + +## ------------------------------------------------------ ## +## Check that config.status detects missing input files. ## +## ------------------------------------------------------ ## + +AT_SETUP([missing templates]) 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 +AC_CONFIG_FILES([nonexistent]) 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) +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) -# Checking that AC_SUBST worked properly. -AT_DATA(expout, -[m4_for(AT_Count, 1, 100, -[Big_Value -])]) +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)