From: Stefano Lattarini Date: Fri, 13 Aug 2010 09:50:31 +0000 (+0200) Subject: Tests: extend checks on remake rules. X-Git-Tag: ng-0.5a~304^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36a58826182f44d25e765816c6a51c3afc8d3f12;p=thirdparty%2Fautomake.git Tests: extend checks on remake rules. This adds proper semantical tests (i.e. run make to check the rebuild rules are correctly triggered) in addition to tentative grepping of the generated Makefile.in(s). * tests/remake.test: Enable `errexit' shell flag, and related changes. Modernize `configure.in'. Add trailing `:' command. Improve heading comments, and add a reference to new sister test remake1a.test. * tests/remake3.test: Likewise (but with sister test being remake3a.test). * tests/remake2.test: Improve heading comments. Enable `errexit' shell flag, and related changes. Modernize `configure.in'. Make grepping of `Makefile.in' slightly stricter. Add trailing `:' command. * tests/remake5.test: Also run the `distcheck' target. Add trailing `:' command. Use proper m4 quoting in configure.in. * tests/remake4.test: Prefer `$me' over hard-coded test name. * tests/remake7.test: Use the `configure.in' stub created by ./defs, rather than writing it from scratch. * tests/remake6.test: Likewise. Also, add trailing `:' command, and ensure verbose printing of captured make output. * tests/remake1a.test: New test, sister of remake.test. * tests/remake3a.test: New test, sister of remake3.test. * tests/remake8a.test: New test. * tests/remake8b.test: Likewise. * tests/remake9a.test: Likewise. * tests/remake9b.test: Likewise. * tests/remake9c.test: Likewise. * tests/remake9d.test: Likewise. * tests/remake10a.test: Likewise. * tests/remake10b.test: Likewise. * tests/remake10c.test: Likewise. * tests/remake11.test: Likewise. * tests/remake12.test: Likewise. * tests/Makefile.am (TESTS): Updated. --- diff --git a/ChangeLog b/ChangeLog index 5afdc53e6..d605b228d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2010-12-06 Stefano Lattarini + + Tests: extend checks on remake rules. + This adds proper semantical tests (i.e. run make to check the + rebuild rules are correctly triggered) in addition to tentative + grepping of the generated Makefile.in(s). + * tests/remake.test: Enable `errexit' shell flag, and related + changes. Modernize `configure.in'. Add trailing `:' command. + Improve heading comments, and add a reference to new sister test + remake1a.test. + * tests/remake3.test: Likewise (but with sister test being + remake3a.test). + * tests/remake2.test: Improve heading comments. Enable `errexit' + shell flag, and related changes. Modernize `configure.in'. Make + grepping of `Makefile.in' slightly stricter. Add trailing `:' + command. + * tests/remake5.test: Also run the `distcheck' target. Add + trailing `:' command. Use proper m4 quoting in configure.in. + * tests/remake4.test: Prefer `$me' over hard-coded test name. + * tests/remake7.test: Use the `configure.in' stub created by + ./defs, rather than writing it from scratch. + * tests/remake6.test: Likewise. Also, add trailing `:' command, + and ensure verbose printing of captured make output. + * tests/remake1a.test: New test, sister of remake.test. + * tests/remake3a.test: New test, sister of remake3.test. + * tests/remake8a.test: New test. + * tests/remake8b.test: Likewise. + * tests/remake9a.test: Likewise. + * tests/remake9b.test: Likewise. + * tests/remake9c.test: Likewise. + * tests/remake9d.test: Likewise. + * tests/remake10a.test: Likewise. + * tests/remake10b.test: Likewise. + * tests/remake10c.test: Likewise. + * tests/remake11.test: Likewise. + * tests/remake12.test: Likewise. + * tests/Makefile.am (TESTS): Updated. + 2010-12-10 Ralf Wildenhues Avoid running installed automake from 'libtool --help'. diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e393..8b8193263 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -614,12 +614,25 @@ python12.test \ recurs.test \ recurs2.test \ remake.test \ +remake1a.test \ remake2.test \ remake3.test \ +remake3a.test \ remake4.test \ remake5.test \ remake6.test \ remake7.test \ +remake8a.test \ +remake8b.test \ +remake9a.test \ +remake9b.test \ +remake9c.test \ +remake9d.test \ +remake10a.test \ +remake10b.test \ +remake10c.test \ +remake11.test \ +remake12.test \ regex.test \ req.test \ reqd.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f4334..0d494e793 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -881,12 +881,25 @@ python12.test \ recurs.test \ recurs2.test \ remake.test \ +remake1a.test \ remake2.test \ remake3.test \ +remake3a.test \ remake4.test \ remake5.test \ remake6.test \ remake7.test \ +remake8a.test \ +remake8b.test \ +remake9a.test \ +remake9b.test \ +remake9c.test \ +remake9d.test \ +remake10a.test \ +remake10b.test \ +remake10c.test \ +remake11.test \ +remake12.test \ regex.test \ req.test \ reqd.test \ diff --git a/tests/remake.test b/tests/remake.test index 9c86b1b7f..4d3036b1d 100755 --- a/tests/remake.test +++ b/tests/remake.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 2000, 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 @@ -14,20 +15,27 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure remaking rules in subdir are correctly generated. +# Weak "grepping" test trying to ensure that remaking rules in a subdir +# are correctly generated. +# See also sister functional test `remake1a.test'. . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(sub/Makefile) +set -e + +cat > configure.in < sub/Makefile.am -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^Makefile' sub/Makefile.in + +: diff --git a/tests/remake10a.test b/tests/remake10a.test new file mode 100755 index 000000000..cda72b0e1 --- /dev/null +++ b/tests/remake10a.test @@ -0,0 +1,108 @@ +#! /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 remake rules for m4 files included (also recursively) by +# configure.ac. +# Keep in sync with sister tests `remake10b.test' and `remake10c.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ +magic3=%%MagicStringThree%% + +cat >> configure.in < Makefile.am <<'END' +.PHONY: nil +nil: +## Used by "make distcheck" later. +check-local: + test -f $(top_srcdir)/foo.m4 + test ! -r $(top_srcdir)/bar.m4 + test x'$(FINGERPRINT)' = x'DummyValue' +END + +echo 'm4_define([my_fingerprint], [BadBadBad])' > foo.m4 + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + top_srcdir=.. + else + top_srcdir=. + fi + + $top_srcdir/configure + $MAKE # should be no-op + + $sleep + echo "m4_define([my_fingerprint], [$magic1])" > $top_srcdir/foo.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + + $sleep + echo "m4_define([my_fingerprint], [$magic2])" > $top_srcdir/foo.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + + $sleep + echo "m4_include([bar.m4])" > $top_srcdir/foo.m4 + echo "m4_define([my_fingerprint], [$magic3])" > $top_srcdir/bar.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile && Exit 1 + $FGREP $magic3 Makefile + + $sleep + echo "m4_define([my_fingerprint], [$magic1])" > $top_srcdir/bar.m4 + $MAKE nil + $FGREP $magic2 Makefile && Exit 1 + $FGREP $magic3 Makefile && Exit 1 + $FGREP $magic1 Makefile + + $sleep + echo "m4_define([my_fingerprint], [DummyValue])" > $top_srcdir/foo.m4 + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + $FGREP $magic3 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $top_srcdir + +done + +: diff --git a/tests/remake10b.test b/tests/remake10b.test new file mode 100755 index 000000000..53a7d13b8 --- /dev/null +++ b/tests/remake10b.test @@ -0,0 +1,107 @@ +#! /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 remake rules for am files included (also recursively) by +# Makefile.am. +# Keep in sync with sister tests `remake10a.test' and `remake10c.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ +magic3=%%MagicStringThree%% + +cat >> configure.in <<'END' +AC_OUTPUT +END + +cat > Makefile.am <<'END' +.PHONY: nil +nil: +include foo.am +## Used by "make distcheck" later. +check-local: + test -f $(top_srcdir)/foo.am + test ! -r $(top_srcdir)/bar.am + test x'$(FINGERPRINT)' = x'DummyValue' +END + +echo 'FINGERPRINT = BadBadBad' > foo.am + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + top_srcdir=.. + else + top_srcdir=. + fi + + $top_srcdir/configure + $MAKE # should be no-op + + $sleep + echo "FINGERPRINT = $magic1" > $top_srcdir/foo.am + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + + $sleep + echo "FINGERPRINT = $magic2" > $top_srcdir/foo.am + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + + $sleep + echo 'include $(top_srcdir)/bar.am' > $top_srcdir/foo.am + echo "FINGERPRINT = $magic3" > $top_srcdir/bar.am + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile && Exit 1 + $FGREP $magic3 Makefile + + $sleep + echo "FINGERPRINT = $magic1" > $top_srcdir/bar.am + $MAKE nil + $FGREP $magic2 Makefile && Exit 1 + $FGREP $magic3 Makefile && Exit 1 + $FGREP $magic1 Makefile + + $sleep + echo "FINGERPRINT = DummyValue" > $top_srcdir/foo.am + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + $FGREP $magic3 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $top_srcdir + +done + +: diff --git a/tests/remake10c.test b/tests/remake10c.test new file mode 100755 index 000000000..96e2c0d44 --- /dev/null +++ b/tests/remake10c.test @@ -0,0 +1,112 @@ +#! /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 remake rules for m4 files included (also recursively) by +# aclocal.m4. +# Keep in sync with sister tests `remake10a.test' and `remake10b.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ +magic3=%%MagicStringThree%% + +cat >> configure.in < Makefile.am <<'END' +ACLOCAL_AMFLAGS = -I m4 +.PHONY: nil +nil: +## Used by "make distcheck" later. +check-local: + test -f $(top_srcdir)/m4/foo.m4 + test ! -r $(top_srcdir)/m4/bar.m4 + test x'$(FINGERPRINT)' = x'DummyValue' +END + +mkdir m4 +echo 'AC_DEFUN([my_fingerprint], [BadBadBad])' > m4/foo.m4 + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL -I m4 +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + top_srcdir=.. + else + top_srcdir=. + fi + + $top_srcdir/configure + $MAKE # should be no-op + + $sleep + echo "AC_DEFUN([my_fingerprint], [$magic1])" > $top_srcdir/m4/foo.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + + $sleep + echo "AC_DEFUN([my_fingerprint], [$magic2])" > $top_srcdir/m4/foo.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + + $sleep + echo "m4_include([m4/bar.m4])" > $top_srcdir/m4/foo.m4 + echo "AC_DEFUN([my_fingerprint], [$magic3])" > $top_srcdir/m4/bar.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile && Exit 1 + $FGREP $magic3 Makefile + + $sleep + echo "AC_DEFUN([my_fingerprint], [$magic1])" > $top_srcdir/m4/bar.m4 + $MAKE nil + $FGREP $magic2 Makefile && Exit 1 + $FGREP $magic3 Makefile && Exit 1 + $FGREP $magic1 Makefile + + $sleep + echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $top_srcdir/m4/foo.m4 + echo "AC_DEFUN([AM_UNUSED], [NoSuchMacro])" > $top_srcdir/m4/bar.m4 + $MAKE nil # required to work around limitation of GNU make 3.82 + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + $FGREP $magic3 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $top_srcdir + +done + +: diff --git a/tests/remake11.test b/tests/remake11.test new file mode 100755 index 000000000..7eaad6c97 --- /dev/null +++ b/tests/remake11.test @@ -0,0 +1,84 @@ +#! /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 remake rules in deeply nested subdirectories, and with a lot +# of files. This is basically a mild stress test, ensuring that rebuild +# rules don't break in obvious ways in a slightly "heavier than usual" +# setup. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +ocwd=`pwd` || Exit 1 + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ + +echo "AC_SUBST([FOO], [$magic1])" >> configure.in + +echo "@FOO@" > bar.in +echo "AC_CONFIG_FILES([bar])" >> configure.in +for i in 0 1 2 3 4 5 6 7 8 9; do + d=${d+"$d/"}sub$i + echo "SUBDIRS = sub$i" > Makefile.am + echo "AC_CONFIG_FILES([$d/Makefile])" >> "$ocwd"/configure.in + echo "AC_CONFIG_FILES([$d/bar])" >> "$ocwd"/configure.in + mkdir sub$i + cd sub$i + echo "$d: @FOO@" > bar.in +done +echo AC_OUTPUT >> "$ocwd"/configure.in +: > Makefile.am +unset d i +bottom=`pwd` + +cd "$ocwd" + +makefiles_am_list=`find . -name Makefile.am | LC_ALL=C sort` +makefiles_list=`echo "$makefiles_am_list" | sed 's/\.am$//'` +bar_in_list=`find . -name bar.in | LC_ALL=C sort` +bar_list=`echo "$bar_in_list" | sed 's/\.in$//'` + +cat configure.in # useful for debugging + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +for f in configure config.status $makefiles_list $bar_list; do + $FGREP "$magic1" $f +done + +$sleep +sed "s/$magic1/$magic2/" configure.in >configure.tmp +mv -f configure.tmp configure.in + +cd "$bottom" +$MAKE +cd "$ocwd" + +for f in configure config.status $makefiles_list $bar_list; do + $FGREP "$magic2" $f +done +$FGREP "$magic1" configure config.status $makefiles_list $bar_list && Exit 1 + +$MAKE distcheck + +: diff --git a/tests/remake12.test b/tests/remake12.test new file mode 100755 index 000000000..63ea39d06 --- /dev/null +++ b/tests/remake12.test @@ -0,0 +1,122 @@ +#! /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 basic remake rules for Makefiles with non-default names +# and/or with multiple sources. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ +magic3=%%MagicStringThree%% + +cat > configure.in < zardoz.am < Makefile <> Makefile <<'END' +my-check: + ls -l . $(srcdir) ;: for debugging + test -f $(srcdir)/quux.am + test -f $(srcdir)/quux.in + test -f $(srcdir)/bot.in + test -f $(srcdir)/top.in + test ! -r $(srcdir)/zardoz.am + test ! -r $(srcdir)/zardoz.in + grep FOO zardoz ;: for debugging + test x'$(FOO)' = x'%MAGIC3%' +test: + ls -l ;: for debugging + test x'$(FOO)' = x'dummy' +.PHONY: test my-check +END +sed "s/^#H:.*/#H: $magic2/" zardoz.am > t +cat >> t <<'END' +# used by "make distcheck" below +check-local: my-check +END +mv -f t zardoz.am +cat zardoz.am # for debugging +$MAKE nil +$FGREP my-check zardoz # sanity check +$FGREP $magic1 zardoz zardoz.in && Exit 1 +$FGREP $magic2 zardoz +$FGREP $magic2 zardoz.in + +./configure + +$sleep +sed 's/^\(AC_CONFIG_FILES\)(.*/\1([zardoz:top.in:quux.in:bot.in])/' \ + t +mv -f t configure.in +cat configure.in # for debugging +sed '/^#H:/d' zardoz.am > quux.am +echo 'FOO = dummy' >> quux.am +echo 'BAR = $(BAZ)' > top.in +echo "BAZ = $magic3" > bot.in +$MAKE test +$FGREP my-check zardoz # sanity check +$FGREP $magic3 quux.in && Exit 1 +$FGREP $magic3 zardoz +$FGREP $magic1 zardoz && Exit 1 +$FGREP $magic2 zardoz && Exit 1 +# After the remake above, the files `zardoz.am' and `zardoz.in' +# should be no more needed +echo 'endif' > zardoz.am # put in syntax error +$MAKE test +rm -f zardoz.in zardoz.am # get rid of them +$MAKE test + +echo 'FOO = $(BAR)' >> quux.am +$MAKE distcheck + +: diff --git a/tests/remake1a.test b/tests/remake1a.test new file mode 100755 index 000000000..ce80c1960 --- /dev/null +++ b/tests/remake1a.test @@ -0,0 +1,57 @@ +#! /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 remaking rules in subdir are correctly generated. +# See also sister "grepping" test `remake.test'. + +. ./defs || Exit 1 + +fingerprint='=/FiNgErPrInT/=' + +set -e + +cat > configure.in < sub/Makefile.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +# Rebuild rules should work even if there is no top-level +# makefiles, if we are careful enough to trigger them only +# in proper subdirs +$sleep +echo "# $fingerprint" > sub/Makefile.am +cd sub +$MAKE Makefile +cd .. +# Check that no spurious Makefile has been created in the +# top-level directory. +test ! -r Makefile +# Check that the Makefile in the subdirectory has been properly +# updated. +$FGREP "$fingerprint" sub/Makefile + +: diff --git a/tests/remake2.test b/tests/remake2.test index 3b63dea6c..452e951cb 100755 --- a/tests/remake2.test +++ b/tests/remake2.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 2000, 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 @@ -14,20 +15,27 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure remaking rules in subdir are correct. +# Weak "grepping" test trying to ensure that remaking rules in subdir +# are correct even when there is no upper-level Makefile. +# TODO: we should really add also functional tests for this! . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(sub/Makefile) +set -e + +cat > configure.in < sub/Makefile.am -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE + +grep '\$(AUTOMAKE).*sub/Makefile' sub/Makefile.in -grep 'AUTOMAKE.*sub/Makefile' sub/Makefile.in +: diff --git a/tests/remake3.test b/tests/remake3.test index 08ec16a9e..708dca8fc 100755 --- a/tests/remake3.test +++ b/tests/remake3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 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 @@ -14,14 +14,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Make sure remaking rules work when there is no subdir Makefile. +# Weak "grepping" test trying to ensure that remake rules work for files +# in a subdirectory even when there is no Makefile for that subdirectory. +# See also sister functional test `remake3a.test'. . ./defs || Exit 1 -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile sub/foo) +set -e + +cat >> configure.in << 'END' +AC_CONFIG_FILES([sub/foo]) +AC_OUTPUT END : > Makefile.am @@ -29,7 +32,9 @@ END mkdir sub : > sub/foo.in -$ACLOCAL || Exit 1 -$AUTOMAKE || Exit 1 +$ACLOCAL +$AUTOMAKE grep '^sub/foo' Makefile.in + +: diff --git a/tests/remake3a.test b/tests/remake3a.test new file mode 100755 index 000000000..a58c46255 --- /dev/null +++ b/tests/remake3a.test @@ -0,0 +1,75 @@ +#! /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 . + +# Ensure that remake rules work for files in a subdirectory even when +# there is no Makefile for that subdirectory. +# See also sister "grepping" test `remake3.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_CONFIG_FILES([sub/foo]) +AC_OUTPUT +END + +cat > Makefile.am <<'END' +all-local: sub/foo +END + +mkdir sub +: > sub/foo.in + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +# First a VPATH build. +mkdir build +cd build +../configure +$sleep +test -f sub/foo +test ! -s sub/foo +echo '#GrepMe#' > ../sub/foo.in +$MAKE +grep '#GrepMe#' sub/foo + +cd .. + +# Now try an in-tree build. +: > sub/foo.in # restore its original (empty) content +./configure +$sleep +test -f sub/foo +test ! -s sub/foo +echo '#GrepMe#' > sub/foo.in +$MAKE +grep '#GrepMe#' sub/foo + +# Finally try to check the distribution. +$sleep +echo '%GrepMe%' > sub/foo.in +cat >>Makefile.am <>configure.in <<'EOF' AM_MAINTAINER_MODE -m4_include(foo.m4) +m4_include([foo.m4]) if test ! -f rebuild_ok; then ACLOCAL=false AUTOMAKE=false @@ -70,3 +70,8 @@ $sleep echo 'AC_SUBST([YIPPY_YIPPY_YEAH])' >foo.m4 $MAKE grep YIPPY_YIPPY_YEAH Makefile + +# Try the distribution, for completeness. +$MAKE distcheck + +: diff --git a/tests/remake6.test b/tests/remake6.test index a25e486a9..885bcb40a 100755 --- a/tests/remake6.test +++ b/tests/remake6.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 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 @@ -17,12 +17,12 @@ # Make sure remaking rules work when subdir Makefile.in has been removed. . ./defs || Exit 1 + set -e -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile sub/Makefile) +cat >> configure.in << 'END' +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT END cat > Makefile.am <<'END' @@ -42,23 +42,25 @@ $MAKE # only. rm -f Makefile.in -$MAKE >stdout +$MAKE >stdout || { cat stdout; Exit 1; } cat stdout test `grep -c " --run " stdout` -eq 1 rm -f sub/Makefile.in -$MAKE >stdout +$MAKE >stdout || { cat stdout; Exit 1; } cat stdout test `grep -c " --run " stdout` -eq 1 $sleep # Let touched files appear newer. touch Makefile.am -$MAKE >stdout +$MAKE >stdout || { cat stdout; Exit 1; } cat stdout test `grep -c " --run " stdout` -eq 1 touch sub/Makefile.am -$MAKE >stdout +$MAKE >stdout || { cat stdout; Exit 1; } cat stdout test `grep -c " --run " stdout` -eq 1 + +: diff --git a/tests/remake7.test b/tests/remake7.test index 670f60b00..66d4b9c59 100755 --- a/tests/remake7.test +++ b/tests/remake7.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 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 @@ -17,12 +17,12 @@ # Make sure remaking rules fail when they should. . ./defs || Exit 1 + set -e -cat > configure.in << 'END' -AC_INIT -AM_INIT_AUTOMAKE(nonesuch, nonesuch) -AC_OUTPUT(Makefile sub/Makefile) +cat >> configure.in << 'END' +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT END cat > Makefile.am <<'END' @@ -67,4 +67,5 @@ $MAKE && Exit 1 rm -f Makefile.in $MAKE && Exit 1 + : diff --git a/tests/remake8a.test b/tests/remake8a.test new file mode 100755 index 000000000..9e66540f7 --- /dev/null +++ b/tests/remake8a.test @@ -0,0 +1,193 @@ +#! /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 basic remake rules for Makefiles, for an *in-tree build*. +# This testcase checks dependency of generated Makefile from Makefile.am, +# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered +# by aclocal. +# Keep this in sync with sister test `remake8b.test', which performs the +# same checks for a VPATH build. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +mv -f configure.in configure.stub + +cat > Makefile.am <<'END' +all-local: foo +foo: + echo '!Foo!' >$@ +check-local: + cat foo + grep '!Foo!' foo +CLEANFILES = foo +END + +cat configure.stub - > configure.in <<'END' +AC_OUTPUT +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +srcdir='.' # to make syncing with remake8b.test easier. + +$srcdir/configure + +$MAKE +cat foo +grep '!Foo!' foo +$MAKE distcheck + +rm -f foo + +# Modify just Makefile.am. + +$sleep + +cat > $srcdir/Makefile.am <<'END' +all-local: bar +bar: + echo '!Baz!' >$@ +check-local: + cat bar + grep '!Baz!' bar + test ! -r $(srcdir)/foo + test ! -r foo +CLEANFILES = bar +END + +$MAKE +cat bar +grep '!Baz!' bar +test ! -r foo +$MAKE distcheck + +rm -f bar + +# Modify Makefile.am and configure.in. + +$sleep + +cat > $srcdir/Makefile.am <<'END' +all-local: quux +check-local: + cat quux + grep '!Zardoz!' quux + test ! -r $(srcdir)/bar + test ! -r bar +END + +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END' +AC_CONFIG_FILES([quux]) +AC_SUBST([QUUX], [Zardoz]) +AC_OUTPUT +END + +cat > $srcdir/quux.in <<'END' +!@QUUX@! +END + +$MAKE +cat quux +grep '!Zardoz!' quux +test ! -r bar +$MAKE distcheck + +rm -f quux + +# Modify Makefile.am to add a directory of extra m4 files +# considered by aclocal. + +$sleep + +mkdir $srcdir/m4 + +cat > $srcdir/Makefile.am <<'END' +ACLOCAL_AMFLAGS = -I m4 +all-local: quux +check-local: + cat quux + grep '%Foo%' quux + test x'$(QUUX)' = x'%Foo%' +END + +$MAKE # this should place aclocal flags in Makefile +grep '.*-I m4' Makefile # sanity check + +# Modify configure.in and aclocal.m4. + +$sleep + +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END' +AC_CONFIG_FILES([quux]) +MY_CUSTOM_MACRO +AC_OUTPUT +END + +cat >> $srcdir/aclocal.m4 <<'END' +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])]) +END + +$MAKE +cat quux +grep '%Foo%' quux +$MAKE distcheck + +# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to +# the directory of extra m4 files considered by aclocal. This new +# file should now provide a macro required by configure.in and that +# was previously provided by aclocal.m4. + +$sleep + +sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t +mv -f t $srcdir/Makefile.am +cat $srcdir/Makefile.am +rm -f $srcdir/aclocal.m4 +cat > $srcdir/m4/blah.m4 <<'END' +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])]) +END + +$MAKE +cat quux +grep '%Bar%' quux +$MAKE distcheck + +# Modify Makefile.am, remove all the extra m4 files to considered +# by aclocal, and add an acinclude.m4 file. This last file should +# now provide a macro required by configure.in, and that was +# previously provided by the extra m4 files considered by aclocal. + +$sleep + +rm -f $srcdir/m4/*.m4 +sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t +mv -f t $srcdir/Makefile.am +cat $srcdir/Makefile.am +cat > $srcdir/acinclude.m4 <<'END' +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])]) +END + +$MAKE +cat quux +grep '%Quux%' quux +$MAKE distcheck + +: diff --git a/tests/remake8b.test b/tests/remake8b.test new file mode 100755 index 000000000..3773aac1e --- /dev/null +++ b/tests/remake8b.test @@ -0,0 +1,195 @@ +#! /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 basic remake rules for Makefiles, for a *VPATH build*. +# This testcase checks dependency of generated Makefile from Makefile.am, +# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered +# by aclocal. +# Keep this in sync with sister test `remake8a.test', which performs the +# same checks for a in-tree build. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +mv -f configure.in configure.stub + +cat > Makefile.am <<'END' +all-local: foo +foo: + echo '!Foo!' >$@ +check-local: + cat foo + grep '!Foo!' foo +CLEANFILES = foo +END + +cat configure.stub - > configure.in <<'END' +AC_OUTPUT +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +mkdir build +cd build +srcdir='..' # to make syncing with remake8a.test easier. + +$srcdir/configure + +$MAKE +cat foo +grep '!Foo!' foo +$MAKE distcheck + +rm -f foo + +# Modify just Makefile.am. + +$sleep + +cat > $srcdir/Makefile.am <<'END' +all-local: bar +bar: + echo '!Baz!' >$@ +check-local: + cat bar + grep '!Baz!' bar + test ! -r $(srcdir)/foo + test ! -r foo +CLEANFILES = bar +END + +$MAKE +cat bar +grep '!Baz!' bar +test ! -r foo +$MAKE distcheck + +rm -f bar + +# Modify Makefile.am and configure.in. + +$sleep + +cat > $srcdir/Makefile.am <<'END' +all-local: quux +check-local: + cat quux + grep '!Zardoz!' quux + test ! -r $(srcdir)/bar + test ! -r bar +END + +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END' +AC_CONFIG_FILES([quux]) +AC_SUBST([QUUX], [Zardoz]) +AC_OUTPUT +END + +cat > $srcdir/quux.in <<'END' +!@QUUX@! +END + +$MAKE +cat quux +grep '!Zardoz!' quux +test ! -r bar +$MAKE distcheck + +rm -f quux + +# Modify Makefile.am to add a directory of extra m4 files +# considered by aclocal. + +$sleep + +mkdir $srcdir/m4 + +cat > $srcdir/Makefile.am <<'END' +ACLOCAL_AMFLAGS = -I m4 +all-local: quux +check-local: + cat quux + grep '%Foo%' quux + test x'$(QUUX)' = x'%Foo%' +END + +$MAKE # this should place aclocal flags in Makefile +grep '.*-I m4' Makefile # sanity check + +# Modify configure.in and aclocal.m4. + +$sleep + +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END' +AC_CONFIG_FILES([quux]) +MY_CUSTOM_MACRO +AC_OUTPUT +END + +cat >> $srcdir/aclocal.m4 <<'END' +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])]) +END + +$MAKE +cat quux +grep '%Foo%' quux +$MAKE distcheck + +# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to +# the directory of extra m4 files considered by aclocal. This new +# file should now provide a macro required by configure.in and that +# was previously provided by aclocal.m4. + +$sleep + +sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t +mv -f t $srcdir/Makefile.am +cat $srcdir/Makefile.am +rm -f $srcdir/aclocal.m4 +cat > $srcdir/m4/blah.m4 <<'END' +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])]) +END + +$MAKE +cat quux +grep '%Bar%' quux +$MAKE distcheck + +# Modify Makefile.am, remove all the extra m4 files to considered +# by aclocal, and add an acinclude.m4 file. This last file should +# now provide a macro required by configure.in, and that was +# previously provided by the extra m4 files considered by aclocal. + +$sleep + +rm -f $srcdir/m4/*.m4 +sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t +mv -f t $srcdir/Makefile.am +cat $srcdir/Makefile.am +cat > $srcdir/acinclude.m4 <<'END' +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])]) +END + +$MAKE +cat quux +grep '%Quux%' quux +$MAKE distcheck + +: diff --git a/tests/remake9a.test b/tests/remake9a.test new file mode 100755 index 000000000..9cd2d9ffd --- /dev/null +++ b/tests/remake9a.test @@ -0,0 +1,106 @@ +#! /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 remake rules when configure.in or its prerequisites change. +# Keep in sync with the other sister tests `remake9*.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ + +cat >> configure.in < Makefile.am <<'END' +nil: +.PHONY: nil + +$(srcdir)/configure.in: $(srcdir)/tweak-configure-in + $(SHELL) $(srcdir)/tweak-configure-in <$@ >$@-t + mv -f $@-t $@ +EXTRA_DIST = $(srcdir)/tweak-configure-in + +# Used by "make distcheck" later. +check-local: + test x'$(FINGERPRINT)' = x'DummyValue' + test x"`./foo.sh`" = x"DummyValue" +END + +cat > foo.in < tweak-configure-in # no-op by default + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + srcdir=.. + else + srcdir=. + fi + + $srcdir/configure + $MAKE # should be no-op + + $sleep + sed "s/^\\(FINGERPRINT\\)=.*/\\1=$magic1/" $srcdir/configure.in >t + mv -f t $srcdir/configure.in + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + test x"`./foo.sh`" = x"$magic1" + + $sleep + echo 'sed "s/^\\(FINGERPRINT\\)=.*/\\1='$magic2'/"' \ + > $srcdir/tweak-configure-in + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + test x"`./foo.sh`" = x"$magic2" + + $sleep + echo cat > $srcdir/tweak-configure-in # no-op again + sed "s/^\\(FINGERPRINT\\)=.*/\\1=DummyValue/" $srcdir/configure.in >t + mv -f t $srcdir/configure.in + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $srcdir + +done + +: diff --git a/tests/remake9b.test b/tests/remake9b.test new file mode 100755 index 000000000..636cc5f02 --- /dev/null +++ b/tests/remake9b.test @@ -0,0 +1,108 @@ +#! /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 remake rules when Makefile.am or its prerequisites change. +# Keep in sync with the other sister tests `remake9*.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ + +cat >> configure.in < Makefile.am <<'END' +FINGERPRINT = BadBadBad + +all-local: nil +nil: foo.sh +.PHONY: nil + +$(srcdir)/Makefile.am: $(srcdir)/tweak-makefile-am + $(SHELL) $(srcdir)/tweak-makefile-am <$@ >$@-t + mv -f $@-t $@ +EXTRA_DIST = $(srcdir)/tweak-makefile-am + +foo.sh: Makefile + rm -f $@ $@-t + echo '#!/bin/sh' > $@-t + echo "echo '$(FINGERPRINT)'" >> $@-t + chmod a+x $@-t && mv -f $@-t $@ +CLEANFILES = foo.sh + +# Used by "make distcheck" later. +check-local: + test x'$(FINGERPRINT)' = x'DummyValue' + test x"`./foo.sh`" = x"DummyValue" +END + +echo cat > tweak-makefile-am # no-op by default + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + srcdir=.. + else + srcdir=. + fi + + $srcdir/configure + $MAKE # should be no-op + + $sleep + sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = $magic1/" $srcdir/Makefile.am >t + mv -f t $srcdir/Makefile.am + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + test x"`./foo.sh`" = x"$magic1" + + $sleep + echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \ + > $srcdir/tweak-makefile-am + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + test x"`./foo.sh`" = x"$magic2" + + $sleep + echo cat > $srcdir/tweak-makefile-am # no-op again + sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am >t + mv -f t $srcdir/Makefile.am + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $srcdir + +done + +: diff --git a/tests/remake9c.test b/tests/remake9c.test new file mode 100755 index 000000000..4514371d4 --- /dev/null +++ b/tests/remake9c.test @@ -0,0 +1,109 @@ +#! /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 remake rules when acinclude.m4 or its prerequisites change. +# Keep in sync with the other sister tests `remake9*.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ + +cat >> configure.in < Makefile.am <<'END' +nil: +.PHONY: nil + +# The right way to extend an autogenerated aclocal.m4 is to provide +# an acinclude.m4 file. +$(srcdir)/acinclude.m4: $(srcdir)/tweak-acinclude-m4 + $(SHELL) $(srcdir)/tweak-acinclude-m4 <$@ >$@-t + mv -f $@-t $@ + touch $@ +EXTRA_DIST = $(srcdir)/tweak-acinclude-m4 + +# Used by "make distcheck" later. +check-local: + test x'$(FINGERPRINT)' = x'DummyValue' + test x"`./foo.sh`" = x"DummyValue" +END + +cat > foo.in < acinclude.m4 + +echo : > tweak-acinclude-m4 # no-op by default + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + srcdir=.. + else + srcdir=. + fi + + $srcdir/configure + $MAKE # should be no-op + + $sleep + echo "AC_DEFUN([my_fingerprint], [$magic1])" > $srcdir/acinclude.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + test x"`./foo.sh`" = x"$magic1" + + $sleep + echo "echo 'AC_DEFUN([my_fingerprint], [$magic2])'" \ + > $srcdir/tweak-acinclude-m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + test x"`./foo.sh`" = x"$magic2" + + $sleep + echo : > $srcdir/tweak-acinclude-m4 # no-op again + echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $srcdir/acinclude.m4 + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $srcdir + +done + +: diff --git a/tests/remake9d.test b/tests/remake9d.test new file mode 100755 index 000000000..b83dd899d --- /dev/null +++ b/tests/remake9d.test @@ -0,0 +1,109 @@ +#! /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 remake rules when aclocal.m4 or its prerequisites change. +# Keep in sync with the other sister tests `remake9*.test'. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +magic1=::MagicStringOne:: +magic2=__MagicStringTwo__ + +cat >> configure.in < Makefile.am <<'END' +nil: +.PHONY: nil + +# A non-autogenerated aclocal.m4 can be extended by hand. +$(srcdir)/aclocal.m4: $(srcdir)/tweak-aclocal-m4 + $(SHELL) $(srcdir)/tweak-aclocal-m4 <$@ >$@-t + mv -f $@-t $@ + touch $@ +EXTRA_DIST = $(srcdir)/tweak-aclocal-m4 + +# Used by "make distcheck" later. +check-local: + test x'$(FINGERPRINT)' = x'DummyValue' + test x"`./foo.sh`" = x"DummyValue" +END + +cat > foo.in < tweak-aclocal-m4 # no-op by default + +$sleep # so that generated autotools files will be newer than prerequisites +$ACLOCAL +# Cheatingly mark aclocal.m4 as non auto-generated. +sed '/^ *#.*generated automatically/d' aclocal.m4 > t +mv -f t aclocal.m4 +$AUTOCONF +$AUTOMAKE + +for vpath in : false; do + + if $vpath; then + mkdir build + cd build + srcdir=.. + else + srcdir=. + fi + + $srcdir/configure + $MAKE # should be no-op + + $sleep + echo "AC_DEFUN([my_fingerprint], [$magic1])dnl %%%" >> $srcdir/aclocal.m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile + test x"`./foo.sh`" = x"$magic1" + + $sleep + echo "sed 's/.*dnl *%%%.*/AC_DEFUN([my_fingerprint], [$magic2])/'" \ + > $srcdir/tweak-aclocal-m4 + $MAKE nil + $FGREP FINGERPRINT Makefile # for debugging + $FGREP $magic1 Makefile && Exit 1 + $FGREP $magic2 Makefile + test x"`./foo.sh`" = x"$magic2" + + $sleep + echo cat > $srcdir/tweak-aclocal-m4 # no-op again + echo 'AC_DEFUN([my_fingerprint], [DummyValue])' >> $srcdir/aclocal.m4 + $MAKE distcheck + $FGREP $magic1 Makefile && Exit 1 # sanity check + $FGREP $magic2 Makefile && Exit 1 # likewise + + $MAKE distclean + + cd $srcdir + +done + +: