From: Stefano Lattarini Date: Wed, 14 Jul 2010 13:22:12 +0000 (+0200) Subject: Tweak, extend and improve tests `cond[a-z]*.test'. X-Git-Tag: v1.11.1b~62^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=755ebe3254f669cc35cc10d1100a92d058f54048;p=thirdparty%2Fautomake.git Tweak, extend and improve tests `cond[a-z]*.test'. * tests/condd.test: Add trailing `:' command. Typofix in comment. * tests/condhook.test: Make sure target `install-data-hook' is not called by `make install', but that data files are installed. Use proper m4 quoting in configure.in. Add trailing `:' command. * tests/condhook2.test: New test, sister test of condhook, with inverted semantic. * tests/condinc2.test: Use proper m4 quoting in configure.in. Prefer trailing `:' command over trailing `Exit 0'. * tests/condman2.test: Enable errexit shell flag, and related changes. Add trailing `:' command. * tests/condman.test: Likewise. Also, do not create useless dummy manpages, and use proper m4 quoting in configure.in. * tests/condman3.test: New test, similar to condman.test, but it also runs ./configure and "make install", and check the installed files. * tests/Makefile.am (TESTS): Updated. --- diff --git a/ChangeLog b/ChangeLog index eff021293..6eb364f07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2010-08-08 Stefano Lattarini + Tweak, extend and improve tests `cond[a-z]*.test'. + * tests/condd.test: Add trailing `:' command. Typofix in + comment. + * tests/condhook.test: Make sure target `install-data-hook' is + not called by `make install', but that data files are installed. + Use proper m4 quoting in configure.in. Add trailing `:' command. + * tests/condhook2.test: New test, sister test of condhook, with + inverted semantic. + * tests/condinc2.test: Use proper m4 quoting in configure.in. + Prefer trailing `:' command over trailing `Exit 0'. + * tests/condman2.test: Enable errexit shell flag, and related + changes. Add trailing `:' command. + * tests/condman.test: Likewise. Also, do not create useless + dummy manpages, and use proper m4 quoting in configure.in. + * tests/condman3.test: New test, similar to condman.test, but + it also runs ./configure and "make install", and check the + installed files. + * tests/Makefile.am (TESTS): Updated. + Modernize, improve and/or extend tests `colon*.test. * tests/colon.test: Rely on the `configure.in' stub created by `./defs', rather than writing one from scratch. Do not create diff --git a/tests/Makefile.am b/tests/Makefile.am index e1c94bc34..055814937 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -207,11 +207,13 @@ cond44.test \ cond45.test \ condd.test \ condhook.test \ +condhook2.test \ condinc.test \ condinc2.test \ condlib.test \ condman.test \ condman2.test \ +condman3.test \ configure.test \ confdeps.test \ conff.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index a7a6bab64..a06026e08 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -445,11 +445,13 @@ cond44.test \ cond45.test \ condd.test \ condhook.test \ +condhook2.test \ condinc.test \ condinc2.test \ condlib.test \ condman.test \ condman2.test \ +condman3.test \ configure.test \ confdeps.test \ conff.test \ diff --git a/tests/condd.test b/tests/condd.test index 0e9b6e8b5..b70d69132 100755 --- a/tests/condd.test +++ b/tests/condd.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2004, 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 @@ -23,7 +23,7 @@ set -e cat >> configure.in << 'END' AC_PROG_CC dnl Define a macro with the same name as the conditional to exhibit -dnl any underquotted bug. +dnl any underquoted bug. AC_DEFUN([COND1], ["some'meaningless;characters`]) AM_CONDITIONAL([COND1], false) AC_CONFIG_FILES([foo/Makefile]) @@ -68,3 +68,5 @@ grep "meaningless;characters" configure && Exit 1 $AUTOMAKE ./configure $MAKE test + +: diff --git a/tests/condhook.test b/tests/condhook.test index 06fa88712..bf9225be3 100755 --- a/tests/condhook.test +++ b/tests/condhook.test @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2004, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2007, 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 @@ -15,6 +15,7 @@ # along with this program. If not, see . # Test install when a conditional install-*-hook is not defined. +# Keep this in sync with sister test condhook2.test. # Report by Nik A. Melchior (PR/428). . ./defs || Exit 1 @@ -22,7 +23,7 @@ set -e cat >> configure.in << 'END' -AM_CONDITIONAL(TEST, false) +AM_CONDITIONAL([TEST], [false]) AC_OUTPUT END @@ -30,7 +31,7 @@ cat > Makefile.am << 'END' sysconf_DATA = mumble if TEST install-data-hook: - echo foo + : > $(top_srcdir)/bad endif END @@ -39,5 +40,11 @@ END $ACLOCAL $AUTOCONF $AUTOMAKE + ./configure --prefix "`pwd`/inst" + $MAKE install +test -f inst/etc/mumble +test ! -f bad + +: diff --git a/tests/condhook2.test b/tests/condhook2.test new file mode 100755 index 000000000..45e2d43fb --- /dev/null +++ b/tests/condhook2.test @@ -0,0 +1,49 @@ +#!/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 . + +# Test install when a conditional install-*-hook is defined. +# Keep this in sync with sister test condhook.test. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AM_CONDITIONAL([TEST], [true]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +sysconf_DATA = mumble +if TEST +install-data-hook: + : > $(top_srcdir)/good +endif +END + +: > mumble + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure --prefix "`pwd`/inst" + +$MAKE install +test -f inst/etc/mumble +test -f good + +: diff --git a/tests/condinc2.test b/tests/condinc2.test index 088fb5592..900102888 100755 --- a/tests/condinc2.test +++ b/tests/condinc2.test @@ -21,7 +21,7 @@ set -e cat >> configure.in << 'END' -AM_CONDITIONAL(TOBE, false) +AM_CONDITIONAL([TOBE], [false]) END cat > Makefile.am << 'END' @@ -39,3 +39,5 @@ END $ACLOCAL AUTOMAKE_fails grep 'adjunct:3: too many conditionals closed' stderr + +: diff --git a/tests/condman.test b/tests/condman.test index 3dc8bcdd2..ee2d41b03 100755 --- a/tests/condman.test +++ b/tests/condman.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 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 @@ -15,10 +15,13 @@ # along with this program. If not, see . # Make sure conditionals work with man pages. + . ./defs || Exit 1 +set -e + cat >> configure.in << 'END' -AM_CONDITIONAL(FRED, true) +AM_CONDITIONAL([FRED], [true]) END cat > Makefile.am << 'END' @@ -29,8 +32,7 @@ man_MANS = joe.1 endif END -: > foo.1 -: > joe.1 - -$ACLOCAL || Exit 1 +$ACLOCAL $AUTOMAKE + +: diff --git a/tests/condman2.test b/tests/condman2.test index 0b448e241..c0e721676 100755 --- a/tests/condman2.test +++ b/tests/condman2.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 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 @@ -15,16 +15,21 @@ # along with this program. If not, see . # Make sure appropriate man install targets generated in all cases. + . ./defs || Exit 1 +set -e + cat > Makefile.am << 'END' man_MANS = foo.1 foo.2 man5_MANS = foo.5 END -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE + +grep '^install-man1:' Makefile.in +grep '^install-man2:' Makefile.in +grep '^install-man5:' Makefile.in -grep '^install-man1:' Makefile.in || Exit 1 -grep '^install-man2:' Makefile.in || Exit 1 -grep '^install-man5:' Makefile.in || Exit 1 +: diff --git a/tests/condman3.test b/tests/condman3.test new file mode 100755 index 000000000..ff93daf9b --- /dev/null +++ b/tests/condman3.test @@ -0,0 +1,65 @@ +#! /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 . + +# Make sure conditionals work with man pages. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AM_CONDITIONAL([COND], [test x"$FOO" = x"true"]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +if COND +man_MANS = foo.1 +else +man_MANS = bar.2 +endif + +.PHONY: test1 test2 +test1: + test -f $(mandir)/man1/foo.1 + test ! -f $(mandir)/man2/bar.2 +test2: + test ! -f $(mandir)/man1/foo.1 + test -f $(mandir)/man2/bar.2 +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +mkdir dir1 +cd dir1 +../configure FOO=true --prefix="`pwd`/_inst" +sed -n '/man_MANS/p' Makefile # useful for debugging +: > foo.1 +$MAKE install +$MAKE test1 + +cd .. +mkdir dir2 +cd dir2 +../configure FOO=false --prefix="`pwd`/_inst" +sed -n '/man_MANS/p' Makefile # useful for debugging +: > bar.2 +$MAKE install +$MAKE test2 + +: