[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add tests for unusual substitutions and defines, Autotest
From: |
Paul Eggert |
Subject: |
Re: Add tests for unusual substitutions and defines, Autotest |
Date: |
Fri, 04 Feb 2005 23:35:44 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Noah Misch <address@hidden> writes:
> 2005-01-04 Noah Misch <address@hidden>
>
> * tests/autotest.at (Empty test suite): New test.
> * tests/torture.at (Substitute and define special characters)
> (Substitute a 64 KiB string, Define to a 64 KiB string)
> (Substitute a newline, Define a newline): New tests.
Thanks. One minor point: that patch isn't portable since it genertes
a testsuite file that contains very long lines, and POSIX says that
text lines longer than 2048 bytes are not portable. I shrank every 64
KiB string down to a 2000-byte string (which I realize won't catch
some of the bugs you're looking for, but I hope it's better than
nothing) and installed the following slightly-modified version of that
patch.
2005-02-04 Noah Misch <address@hidden>
and Paul Eggert <address@hidden>
* tests/autotest.at (Empty test suite): New test.
* tests/torture.at (Substitute and define special characters)
(Substitute a 2000-byte string, Define to a 2000-byte string)
(Substitute a newline, Define a newline): New tests.
Index: tests/autotest.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/autotest.at,v
retrieving revision 1.4
diff -p -u -r1.4 autotest.at
--- tests/autotest.at 1 Jan 2005 08:12:12 -0000 1.4
+++ tests/autotest.at 5 Feb 2005 07:25:56 -0000
@@ -2,7 +2,7 @@
AT_BANNER([Autotest.])
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -68,6 +68,18 @@ AT_CLEANUP
# Here documents for these tests contain forbidden macros.
m4_pattern_allow([^AT_])
+
+## ------------------ ##
+## Empty test suite. ##
+## ------------------ ##
+
+# This is not a sensible thing to do, but the user should not get a unhelpful
+# error message, which is what happens presently.
+AT_CHECK_AT([Empty test suite],
+[[AT_INIT([empty test suite])
+]], [:])
+
+
## ----------------------------------------------------- ##
## Newlines and command substitutions in test commands. ##
## ----------------------------------------------------- ##
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.49
diff -p -u -r1.49 torture.at
--- tests/torture.at 2 Jan 2005 17:15:40 -0000 1.49
+++ tests/torture.at 5 Feb 2005 07:25:56 -0000
@@ -1,6 +1,7 @@
# -*- Autotest -*-
-# Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -475,6 +476,128 @@ AT_DATA([expout],
AT_CLEANUP
+## ------------------------------- ##
+## Substitute a 2000-byte string. ##
+## ------------------------------- ##
+
+# Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
+# sed dumps core around 8 KiB. However, POSIX says that sed need not
+# handle lines longer than 2048 bytes (including the trailing newline).
+# So we'll just test a 2000-byte value.
+
+AT_SETUP([Substitute a 2000-byte string])
+
+AT_DATA([Foo.in], address@hidden@
+])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_CONFIG_AUX_DIR($top_srcdir/config)
+AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
+AC_CONFIG_FILES([Foo])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
+)
+AT_CLEANUP
+
+
+## ------------------------------ ##
+## Define to a 2000-byte string. ##
+## ------------------------------ ##
+
+AT_SETUP([Define to a 2000-byte string])
+
+AT_CONFIGURE_AC(
+[[
+AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES(address@hidden:@define foo m4_for([n], 1, 100,,
....................)
+])
+AT_CLEANUP
+
+
+## ------------------------------------------ ##
+## Substitute and define special characters. ##
+## ------------------------------------------ ##
+
+# Use characters special to the shell, sed, and M4.
+
+AT_SETUP([Substitute and define special characters])
+
+AT_DATA([Foo.in], address@hidden@
+])
+
+AT_CONFIGURE_AC(
+[[foo="AS@&address@hidden([[X*'[]+ ", `\($foo]])"
+AC_SUBST([foo])
+AC_DEFINE([foo], [[X*'[]+ ", `\($foo]], [Awful value.])
+AC_CONFIG_FILES([Foo])]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK([cat Foo], 0, [[X*'[]+ ", `\($foo
+]])
+AT_CHECK_DEFINES([[#define foo X*'[]+ ", `\($foo
+]])
+AT_CLEANUP
+
+
+## ---------------------- ##
+## Substitute a newline. ##
+## ---------------------- ##
+
+AT_SETUP([Substitute a newline])
+AT_XFAIL_IF(:)
+
+AT_DATA([Foo.in],
address@hidden@
+])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_CONFIG_AUX_DIR($top_srcdir/config)
+foo='one
+two'
+AC_SUBST([foo])
+AC_CONFIG_FILES([Foo])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+AT_CHECK([cat Foo], 0, [one
+two
+])
+AT_CLEANUP
+
+
+## ------------------ ##
+## Define a newline. ##
+## ------------------ ##
+
+AT_SETUP([Define a newline])
+AT_XFAIL_IF(:)
+AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
+two], [This spans two lines.])
+]])
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+AT_CHECK_CONFIGURE
+AT_CHECK_DEFINES([[#define foo one
+two
+]])
+AT_CLEANUP
+
+
## -------- ##
## srcdir. ##
## -------- ##
- Re: Add tests for unusual substitutions and defines, Autotest,
Paul Eggert <=