* tests/subst2.test: Test removed, split into ...
* tests/programs-primary-rewritten.test: ... this test ...
* tests/subst-no-trailing-empty-line.test: ... and this one ...
* tests/extra-programs-empty.test: ... and this one.
* tests/Makefile.am (TESTS): Update.
+2011-05-26 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ tests: split 'subst2.test' to improve modularity and coverage
+ * tests/subst2.test: Test removed, split into ...
+ * tests/programs-primary-rewritten.test: ... this test ...
+ * tests/subst-no-trailing-empty-line.test: ... and this one ...
+ * tests/extra-programs-empty.test: ... and this one.
+ * tests/Makefile.am (TESTS): Update.
+
2011-05-26 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: tweak and improve tests on Automake conditionals
extra10.test \
extra11.test \
extra12.test \
+extra-programs-empty.test \
extradep.test \
extradep2.test \
f90only.test \
primary2.test \
primary3.test \
proginst.test \
+programs-primary-rewritten.test \
python.test \
python2.test \
python3.test \
subpkg3.test \
subpkg4.test \
subst.test \
-subst2.test \
subst3.test \
subst4.test \
subst5.test \
+subst-no-trailing-empty-line.test \
substref.test \
substre2.test \
substtarg.test \
extra10.test \
extra11.test \
extra12.test \
+extra-programs-empty.test \
extradep.test \
extradep2.test \
f90only.test \
primary2.test \
primary3.test \
proginst.test \
+programs-primary-rewritten.test \
python.test \
python2.test \
python3.test \
subpkg3.test \
subpkg4.test \
subst.test \
-subst2.test \
subst3.test \
subst4.test \
subst5.test \
+subst-no-trailing-empty-line.test \
substref.test \
substre2.test \
substtarg.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003, 2006, 2011 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 that EXTRA_PROGRAMS doesn't get removed because it is empty.
+# This check hs been introduced in commit `Release-1-9-254-g9d0eaef'
+# into the former test `subst2.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([Makefile2 Makefile3])
+AC_SUBST([prog])
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+EXTRA_PROGRAMS =
+END
+
+cat > Makefile2.am <<'END'
+bin_PROGRAMS = a @prog@ b
+EXTRA_PROGRAMS =
+END
+
+cat > Makefile3.am <<'END'
+empty =
+EXTRA_PROGRAMS = $(empty)
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '^EXTRA_PROGRAMS = *$' Makefile.in
+grep '^EXTRA_PROGRAMS = *$' Makefile2.in
+# Be laxer here, since EXTRA_PROGRAMS might be internally rewritten
+# by Automake when it contains references to other variables.
+grep '^EXTRA_PROGRAMS =' Makefile3.in
+
+:
# 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 a multi-line definition cannot be terminated by an empty
-# line (when there are @substitutions@ inside).
+# Make sure xxx_PROGRAMS gets properly rewritten where needed. These
+# checks have been introduced in commit `Release-1-9-254-g9d0eaef' into
+# the former test `subst2.test'.
-required=cc
. ./defs || Exit 1
cat >> configure.in << 'END'
-AC_PROG_CC
-AC_SUBST([ABCDEFGHIJKLMNOPQRSTUVWX])
-AC_SUBST([ABCDEFGHIJKLMNOPQRSTUVWXY])
-AC_SUBST([ABCDEFGHIJKLMNOPQRSTUVWXYZ])
+AC_SUBST([FOO], [c])
AC_OUTPUT
END
cat >Makefile.am <<'END'
-bin_PROGRAMS = x @ABCDEFGHIJKLMNOPQRSTUVWX@ @ABCDEFGHIJKLMNOPQRSTUVWXY@ @ABCDEFGHIJKLMNOPQRSTUVWXYZ@
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+EXEEXT = .bin
+
+check_PROGRAMS = a
+bin_PROGRAMS = b @FOO@
+noinst_PROGRAMS = $(bar) $(baz:=de)
EXTRA_PROGRAMS =
-EXEEXT = .bin
+bar = zardoz
+baz = mau
-print-programs:
- @echo BEG: $(bin_PROGRAMS) :END
+.PHONY: test
+test:
+ test '$(check_PROGRAMS)' = a.bin
+ test '$(bin_PROGRAMS)' = 'b.bin c'
+ test '$(noinst_PROGRAMS)' = 'zardoz.bin maude.bin'
END
$ACLOCAL
-$AUTOCONF
$AUTOMAKE
+
+grep PROGRAMS Makefile.in # For debugging.
+
+# Check that no useless indirections are used.
+grep '^check_PROGRAMS = a$(EXEEXT)$' Makefile.in
+grep '^bin_PROGRAMS = b$(EXEEXT) @FOO@$' Makefile.in
+
+$AUTOCONF
./configure
-EXEEXT=.bin $MAKE print-programs >foo
-cat foo
-grep 'BEG: x.bin :END' foo
-EXEEXT=.bin am__empty=X $MAKE -e print-programs >foo
-cat foo
-grep 'BEG: x.bin X :END' foo
-
-# Test for another bug, where EXTRA_PROGRAMS was removed because it was empty.
-grep EXTRA_PROGRAMS Makefile.in
+$MAKE test
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2003, 2006, 2011 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/>.
+
+# If the last line of a automake-rewritten definition is made only of
+# @substitutions@, automake should take care of appending an empty
+# variable to make sure that line cannot end up substituted as a blank
+# line (that would confuse HP-UX Make).
+# These checks have been introduced in commit `Release-1-9-254-g9d0eaef'
+# into the former test `subst2.test'.
+
+. ./defs || Exit 1
+
+v1=ABCDEFGHIJKLMNOPQRSTUVWX
+v2=ABCDEFGHIJKLMNOPQRSTUVWXY
+v3=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+bs='\\' # Literal backslash for grep.
+
+cat >> configure.in <<END
+AC_SUBST([A], [''])
+# These are deliberately quite long, so that the xxx_PROGRAMS definition
+# in Makefile.am below will be split on multiple lines, with the last
+# line
+AC_SUBST([$v1], [''])
+AC_SUBST([$v2], [''])
+AC_SUBST([$v3], [''])
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+EXEEXT =
+
+noinst_PROGRAMS = x @$v1@ @$v2@ @$v3@
+bin_PROGRAMS = @A@ mu @$v2@ @$v3@
+check_PROGRAMS = zardoz \$(noinst_PROGRAMS)
+
+## Required whenever there are @substituted@ values in the
+## PROGRAMS primary, otherwise automake will complain.
+EXTRA_PROGRAMS =
+
+print-programs:
+ @echo BEG1: \$(noinst_PROGRAMS) :END1
+ @echo BEG2: \$(bin_PROGRAMS) :END2
+ @echo BEG3: \$(check_PROGRAMS) :END3
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+$EGREP -n 'ABCD|am__empty' Makefile.in # For debugging,
+# Sanity check.
+test `$EGREP -c "^[ $tab]*@$v2@ @$v3@[ $tab]*$bs?$" Makefile.in` -eq 2
+
+./configure
+{
+ sed -n '/^noinst_PROGRAMS =/,/[^\\]$/p' Makefile
+ sed -n '/^bin_PROGRAMS =/,/[^\\]$/p' Makefile
+ sed -n '/^check_PROGRAMS =/,/[^\\]$/p' Makefile
+} >t-programs
+cat t-programs
+grep '^ *$' t-programs && Exit 1
+
+$MAKE print-programs >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^BEG1: x :END1$' stdout
+grep '^BEG2: mu :END2$' stdout
+grep '^BEG3: zardoz x :END3$' stdout
+
+am__empty=X $MAKE -e print-programs >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^BEG1: x X :END1$' stdout
+grep '^BEG2: mu X :END2$' stdout
+grep '^BEG3: zardoz x X :END3$' stdout
+
+: