From: Stefano Lattarini Date: Mon, 28 Jun 2010 10:40:55 +0000 (+0200) Subject: Improve and extend tests on canonicalization. X-Git-Tag: ng-0.5a~305^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddc5c084bf1e2736e5c6e600ae40b29d953e84ac;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 5afdc53e6..5717b219d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2010-12-11 Stefano Lattarini + + 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 Avoid running installed automake from 'libtool --help'. diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e393..1871512fc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f4334..f8ca8f880 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 \ diff --git a/tests/canon-name.test b/tests/canon-name.test index aecda1720..b8e53310f 100755 --- a/tests/canon-name.test +++ b/tests/canon-name.test @@ -21,8 +21,8 @@ set -e -cat > configure.in << 'END' -AC_INIT([canon-name], [1.0]) +cat > configure.in <> 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 + +: diff --git a/tests/canon3.test b/tests/canon3.test index 9d5a17238..ce5876a30 100755 --- a/tests/canon3.test +++ b/tests/canon3.test @@ -34,4 +34,5 @@ $ACLOCAL $AUTOMAKE $FGREP 'perm_number.c' Makefile.in && Exit 1 -Exit 0 + +: diff --git a/tests/canon4.test b/tests/canon4.test index 52e968dc5..454b4ef0f 100755 --- a/tests/canon4.test +++ b/tests/canon4.test @@ -14,7 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# 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 + +: diff --git a/tests/canon5.test b/tests/canon5.test index 53cdeb2a2..3bd99abcd 100755 --- a/tests/canon5.test +++ b/tests/canon5.test @@ -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 index 000000000..d103996c7 --- /dev/null +++ b/tests/canon6.test @@ -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 . + +# 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 index 000000000..9b3d8d067 --- /dev/null +++ b/tests/canon7.test @@ -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 . + +# 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 +int main(void) +{ + printf("Hello, FooBar!\n"); + return 0; +} +END + +cat > dummy.c << 'END' +#include +#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 index 000000000..2ae47dd4e --- /dev/null +++ b/tests/canon8.test @@ -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 . + +# 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 + +: