Tweak, extend and improve tests `cond[a-z]*.test'.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 14 Jul 2010 13:22:12 +0000 (15:22 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 10 Aug 2010 17:39:22 +0000 (19:39 +0200)
* 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.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/condd.test
tests/condhook.test
tests/condhook2.test [new file with mode: 0755]
tests/condinc2.test
tests/condman.test
tests/condman2.test
tests/condman3.test [new file with mode: 0755]

index eff0212..6eb364f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2010-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       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
index e1c94bc..0558149 100644 (file)
@@ -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 \
index a7a6bab..a06026e 100644 (file)
@@ -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 \
index 0e9b6e8..b70d691 100755 (executable)
@@ -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
+
+:
index 06fa887..bf9225b 100755 (executable)
@@ -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 <http://www.gnu.org/licenses/>.
 
 # 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 (executable)
index 0000000..45e2d43
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+:
index 088fb55..9001028 100755 (executable)
@@ -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
+
+:
index 3dc8bcd..ee2d41b 100755 (executable)
@@ -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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # 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
+
+:
index 0b448e2..c0e7216 100755 (executable)
@@ -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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # 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 (executable)
index 0000000..ff93daf
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+: