]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Improve and extend tests on canonicalization.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 28 Jun 2010 10:40:55 +0000 (12:40 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 13 Dec 2010 20:49:06 +0000 (21:49 +0100)
* tests/canon-name.test: Add trailing `:' command.  When writing
configure.in, prefer to use $me instead of hard-coding the test
name.
* tests/canon3.test: Prefer trailing `:' over trailing `Exit 0'.
* tests/canon4.test: Likewise.  Make grepping of Makefile.in
stricter.  Improve heading comment, and add reference to ...
* tests/canon6.test: ... this new test (sister test of the
previous one).
* tests/canon.test: Prefer cat + here-doc over echo to append
text to configure.in.  Extend grepping of Automake stderr.  Add
trailing `:' command.
* tests/canon5.test: Likewise.
* tests/canon7.test: New file, stress test on canonicalization.
* tests/canon8.test: New test, for better coverage (check that
the `@' character is not transliterated in canonicalizations).
* tests/Makefile.am: Updated.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/canon-name.test
tests/canon.test
tests/canon3.test
tests/canon4.test
tests/canon5.test
tests/canon6.test [new file with mode: 0755]
tests/canon7.test [new file with mode: 0755]
tests/canon8.test [new file with mode: 0755]

index 5afdc53e64ad6c2d572ee187fc019a0f2db38854..5717b219d7d00a0c82d6702a13440af4efd3c537 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2010-12-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Improve and extend tests on canonicalization.
+       * tests/canon-name.test: Add trailing `:' command.  When writing
+       configure.in, prefer to use $me instead of hard-coding the test
+       name.
+       * tests/canon3.test: Prefer trailing `:' over trailing `Exit 0'.
+       * tests/canon4.test: Likewise.  Make grepping of Makefile.in
+       stricter.  Improve heading comment, and add reference to ...
+       * tests/canon6.test: ... this new test (sister test of the
+       previous one).
+       * tests/canon.test: Prefer cat + here-doc over echo to append
+       text to configure.in.  Extend grepping of Automake stderr.  Add
+       trailing `:' command.
+       * tests/canon5.test: Likewise.
+       * tests/canon7.test: New file, stress test on canonicalization.
+       * tests/canon8.test: New test, for better coverage (check that
+       the `@' character is not transliterated in canonicalizations).
+       * tests/Makefile.am: Updated.
+
 2010-12-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Avoid running installed automake from 'libtool --help'.
index dab04e39336af6e94f6758b401366ee90e341e4b..1871512fcc5325b212b1e5ca5229891a8ca91400 100644 (file)
@@ -118,6 +118,9 @@ canon2.test \
 canon3.test \
 canon4.test \
 canon5.test \
+canon6.test \
+canon7.test \
+canon8.test \
 canon-name.test \
 ccnoco.test \
 ccnoco2.test \
index de21f4334e83da8adf72837774285defe8cbafe1..f8ca8f8808587188cb40287664b2b4ef5b446bb2 100644 (file)
@@ -385,6 +385,9 @@ canon2.test \
 canon3.test \
 canon4.test \
 canon5.test \
+canon6.test \
+canon7.test \
+canon8.test \
 canon-name.test \
 ccnoco.test \
 ccnoco2.test \
index aecda1720aca36ea2d280332a4339dd798087f40..b8e53310f812f061efd66d3f496419d416e6a6ff 100755 (executable)
@@ -21,8 +21,8 @@
 
 set -e
 
-cat > configure.in << 'END'
-AC_INIT([canon-name], [1.0])
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([./gmakefile ./sub/gmakefile])
 AC_OUTPUT
@@ -36,3 +36,5 @@ $ACLOCAL
 AUTOMAKE_fails
 grep 'leading.*\./.*\./gmakefile' stderr
 grep 'leading.*\./.*\./sub/gmakefile' stderr
+
+:
index 2b035d0aa2abca81354330149ebb5496accae986..fc524fdbd02140d9e17cd0463170b63a1c25492a 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2010 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
@@ -20,7 +21,9 @@
 
 set -e
 
-echo AC_PROG_CC >> configure.in
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = sniff-glue
@@ -29,4 +32,7 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*sniff_glue_SOURCES' stderr
+grep 'Makefile\.am:2:.* bad .*variable.*sniff-glue_SOURCES' stderr
+grep 'Makefile\.am:2:.* use .*sniff_glue_SOURCES' stderr
+
+:
index 9d5a1723856d6dc05047e90a04b21d5b70482edb..ce5876a30679bf3d2376b3fb46d5e6c8626b3093 100755 (executable)
@@ -34,4 +34,5 @@ $ACLOCAL
 $AUTOMAKE
 
 $FGREP 'perm_number.c' Makefile.in && Exit 1
-Exit 0
+
+:
index 52e968dc5b55921383fa39e62223206f89dd7ba5..454b4ef0f738acd39262cea978c3fce242d0da3c 100755 (executable)
@@ -14,7 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure name canonicalization happens for libraries.
+# Test to make sure name canonicalization happens for static libraries.
+# Keep this in sync with sister test `canon6.test'.
 
 . ./defs || Exit 1
 
@@ -33,5 +34,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-grep '^libx-y.*=' Makefile.in && Exit 1
-Exit 0
+grep '^ *libx-y.*=' Makefile.in && Exit 1
+
+:
index 53cdeb2a277090e733e4c184a4fc1aacca0f8f93..3bd99abcddccd0244ae7718a06b4c93dc0b14de5 100755 (executable)
@@ -22,7 +22,9 @@
 
 set -e
 
-echo AC_PROG_CC >> configure.in
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 $ACLOCAL
 
@@ -46,7 +48,8 @@ bin_PROGRAMS = ,foo
 END
 
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*_foo_SOURCES' stderr
+grep 'Makefile\.am:2:.* bad .*variable.*,foo_SOURCES' stderr
+grep 'Makefile\.am:2:.* use .*_foo_SOURCES' stderr
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = ,foo
@@ -54,3 +57,5 @@ _foo_SOURCES = foo.c
 END
 
 $AUTOMAKE -Wno-portability
+
+:
diff --git a/tests/canon6.test b/tests/canon6.test
new file mode 100755 (executable)
index 0000000..d103996
--- /dev/null
@@ -0,0 +1,42 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2010 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test to make sure name canonicalization happens for libtool libraries.
+# Keep this in sync with sister test `canon4.test'.
+
+required='libtoolize'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+END
+
+cat > Makefile.am << 'END'
+noinst_LTLIBRARIES = libx-y.la
+libx_y_la_SOURCES = xy.c
+END
+
+: > ltmain.sh
+
+$ACLOCAL
+$AUTOMAKE -a
+
+grep '^ *libx-y.*=' Makefile.in && Exit 1
+
+:
diff --git a/tests/canon7.test b/tests/canon7.test
new file mode 100755 (executable)
index 0000000..9b3d8d0
--- /dev/null
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 2010 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Stress test on canonicalization.
+
+required='libtool libtoolize'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_RANLIB  dnl: for static libraries
+AC_PROG_LIBTOOL dnl: for libtool libraries
+AC_OUTPUT
+END
+
+touch ,foo-bar libb.az+baz lib~zardoz,, || Exit 77
+rm -f ,foo-bar libb.az+baz lib~zardoz,,
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = dummy_static dummy_dynamic ,foo-bar
+noinst_LIBRARIES = libb.az+baz.a
+noinst_LTLIBRARIES = lib~zardoz,,.la
+
+dummy_static_SOURCES = dummy.c lib.h
+dummy_dynamic_SOURCES = $(dummy_static_SOURCES)
+
+dummy_static_LDADD = $(noinst_LIBRARIES)
+dummy_dynamic_LDADD = $(noinst_LTLIBRARIES)
+
+_foo_bar_SOURCES = libs.c
+libb_az_baz_a_SOURCES = libs.c
+lib_zardoz___la_SOURCES = libd.c
+
+check-local:
+       ls -l
+       ./,foo-bar
+       ./dummy_static
+       ./dummy_dynamic
+       ./,foo-bar | grep 'Hello, FooBar!'
+       ./dummy_static | grep 'Hello from Static!'
+       ./dummy_dynamic | grep 'Hello from Dynamic!'
+END
+
+cat > foobar.c << 'END'
+#include <stdio.h>
+int main(void)
+{
+  printf("Hello, FooBar!\n");
+  return 0;
+}
+END
+
+cat > dummy.c << 'END'
+#include <stdio.h>
+#include "lib.h"
+int main(void)
+{
+  printf("Hello from %s!\n", dummy_func());
+  return 0;
+}
+END
+
+echo 'char *dummy_func(void);' > lib.h
+echo 'char *dummy_func(void) { return "Dynamic"; }' > libd.c
+echo 'char *dummy_func(void) { return "Static"; }' > libs.c
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/tests/canon8.test b/tests/canon8.test
new file mode 100755 (executable)
index 0000000..2ae47dd
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 1996, 1997, 2001, 2002, 2010 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that canonicalization does not transliterate the `@' charactrer.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foob@rquux
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+# The first grep is here mostly for debugging.
+grep foob.rquux Makefile.in
+grep foob@rquux Makefile.in
+grep 'foob[^@]rquux' Makefile.in && Exit 1
+
+: