]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Torture test config.status, AC_SUBST and AC_DEFINE.
authorAkim Demaille <akim@epita.fr>
Mon, 7 Feb 2000 17:15:51 +0000 (17:15 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 7 Feb 2000 17:15:51 +0000 (17:15 +0000)
* tests/torture.m4: New file.
* tests/suite.m4: Include it.

ChangeLog
tests/Makefile.am
tests/actest.m4
tests/suite.m4
tests/torture.m4 [new file with mode: 0644]

index b70e93686df1ce922be1e4297f4e02f3a3e680fe..19969bbc13b2986941a02be4f3321b56d45a236c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-02-07  Akim Demaille  <akim@epita.fr>
+
+       Torture test config.status, AC_SUBST and AC_DEFINE.
+
+       * tests/torture.m4: New file.
+       * tests/suite.m4: Include it.
+
 2000-02-07  Akim Demaille  <akim@epita.fr>
 
        * tests/atspecific.m4 (m4_for, m4_foreach): New macros.
index fb825ecefd9c333de03d40af655353ff3380122f..e21190b2caafea851d7a5efaa1929b61637315e3 100644 (file)
@@ -20,7 +20,7 @@
 
 AUTOMAKE_OPTIONS = gnits
 
-SUITE = syntax.m4 semantics.m4
+SUITE = torture.m4 semantics.m4 syntax.m4
 
 # We don't actually distribute the testsuite, since one only
 # needs m4 to build it, m4 being required anyway to install Autoconf.
index 1c027427c4ab790bac3d6fdc2fd43dac031c9c58..ba1c8a566558ceed77e2ee5e4604ee82f4c8270a 100644 (file)
@@ -28,3 +28,17 @@ AC_DEFUN(AC_ENV_SAVE,
   # lines
   fgrep = >$1
 ])
+
+
+
+# AC_DEFUBST(NAME)
+# ----------------
+# Related VALUE to NAME both with AC_SUBST and AC_DEFINE.  This is
+# used in the torture tests.
+AC_DEFUN(AC_DEFUBST,
+[AC_DUMMY_VAR($1)="AC_DEFUBST_VALUE"
+AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1),
+                   "$AC_DUMMY_VAR($1)",
+                   [Define to a long string if your `Autoconf' works
+                    properly.])
+AC_SUBST(AC_DUMMY_VAR($1))])
index 3280be1eeda675534cf44acc99bbb28039da65eb..031a4ddb01910679e2f7e5fc2137c9a0c1524399 100644 (file)
@@ -14,8 +14,8 @@ Some tests might be ignored if you don't have the software which the
 macros are supposed to test (e.g., a Fortran compiler).
 EOF
 
-dnl Run semantics before, since there are little chances that syntax
-dnl fails.
+dnl Run the tests from the most selective to the easiest.
 
+AT_INCLUDE(torture.m4)
 AT_INCLUDE(semantics.m4)
 AT_INCLUDE(syntax.m4)
diff --git a/tests/torture.m4 b/tests/torture.m4
new file mode 100644 (file)
index 0000000..8698ee8
--- /dev/null
@@ -0,0 +1,76 @@
+#                                                      -*- autoconf -*-
+
+cat <<\EOF
+
+Torturing config.status.
+
+## ---------------------------------------------------------------- ##
+## This section of tests is trying to make Autoconf produce failing ##
+## `configure' scripts, which must not happen.  If these tests ever ##
+## fail, it is extremely important that you report the failure to   ##
+## bug-autoconf@gnu.org.                                            ##
+## ---------------------------------------------------------------- ##
+
+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.])
+
+
+# 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_[]patsubst([000$1], [.*\(...\)$], [\1])])
+
+dnl This call was quite delicate to write because we wanted to produce
+dnl the 100 commands at hand.  Be very careful if you want to touch
+dnl something.
+
+## 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_DATA(dummy.in,
+[m4_for(AT_Count, 1, 100,
+[@AT_DUMMY_VAR(AT_Count)@
+])])
+
+AT_TEST_MACRO(config.status under extreme conditions,
+[AC_CONFIG_FILES(dummy)
+[define]([AC_DEFUBST_VALUE], Big_Value)
+[define]([AC_DUMMY_VAR],
+changequote({{, }})dnl
+[defn({{AT_DUMMY_VAR}})]dnl
+changequote([, ]))
+m4_for(AT_Count, 1, 100,
+[AC_DEFUBST(AT_Count)
+])],
+[# 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
+])])
+])