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
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 \
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 \
#! /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
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])
$AUTOMAKE
./configure
$MAKE test
+
+:
#!/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
# 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
set -e
cat >> configure.in << 'END'
-AM_CONDITIONAL(TEST, false)
+AM_CONDITIONAL([TEST], [false])
AC_OUTPUT
END
sysconf_DATA = mumble
if TEST
install-data-hook:
- echo foo
+ : > $(top_srcdir)/bad
endif
END
$ACLOCAL
$AUTOCONF
$AUTOMAKE
+
./configure --prefix "`pwd`/inst"
+
$MAKE install
+test -f inst/etc/mumble
+test ! -f bad
+
+:
--- /dev/null
+#!/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
+
+:
set -e
cat >> configure.in << 'END'
-AM_CONDITIONAL(TOBE, false)
+AM_CONDITIONAL([TOBE], [false])
END
cat > Makefile.am << 'END'
$ACLOCAL
AUTOMAKE_fails
grep 'adjunct:3: too many conditionals closed' stderr
+
+:
#! /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'
endif
END
-: > foo.1
-: > joe.1
-
-$ACLOCAL || Exit 1
+$ACLOCAL
$AUTOMAKE
+
+:
#! /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
+:
--- /dev/null
+#! /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
+
+: