From: Stefano Lattarini Date: Thu, 26 May 2011 20:28:45 +0000 (+0200) Subject: tests: split 'subst2.test' to improve modularity and coverage X-Git-Tag: ng-0.5a~89^2~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02742f0f6ee02cec94a033a446b4a36d90859aca;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 62c6ca47d..24183b73d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-05-26 Stefano Lattarini + + 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 tests: tweak and improve tests on Automake conditionals diff --git a/tests/Makefile.am b/tests/Makefile.am index bcb65d8db..09adc6517 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -461,6 +461,7 @@ extra9.test \ extra10.test \ extra11.test \ extra12.test \ +extra-programs-empty.test \ extradep.test \ extradep2.test \ f90only.test \ @@ -792,6 +793,7 @@ primary.test \ primary2.test \ primary3.test \ proginst.test \ +programs-primary-rewritten.test \ python.test \ python2.test \ python3.test \ @@ -939,10 +941,10 @@ subpkg2.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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 107b35906..ad8b2c03c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -726,6 +726,7 @@ extra9.test \ extra10.test \ extra11.test \ extra12.test \ +extra-programs-empty.test \ extradep.test \ extradep2.test \ f90only.test \ @@ -1057,6 +1058,7 @@ primary.test \ primary2.test \ primary3.test \ proginst.test \ +programs-primary-rewritten.test \ python.test \ python2.test \ python3.test \ @@ -1204,10 +1206,10 @@ subpkg2.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 \ diff --git a/tests/extra-programs-empty.test b/tests/extra-programs-empty.test new file mode 100755 index 000000000..992c5ee42 --- /dev/null +++ b/tests/extra-programs-empty.test @@ -0,0 +1,53 @@ +#! /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 . + +# 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 + +: diff --git a/tests/subst2.test b/tests/programs-primary-rewritten.test similarity index 55% rename from tests/subst2.test rename to tests/programs-primary-rewritten.test index d64d8c0a6..e52bd569a 100755 --- a/tests/subst2.test +++ b/tests/programs-primary-rewritten.test @@ -14,40 +14,48 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# 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 + +: diff --git a/tests/subst-no-trailing-empty-line.test b/tests/subst-no-trailing-empty-line.test new file mode 100755 index 000000000..595644eb4 --- /dev/null +++ b/tests/subst-no-trailing-empty-line.test @@ -0,0 +1,89 @@ +#! /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 . + +# 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 <Makefile.am <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 + +: