[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Extend checks on remake rules.
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] Extend checks on remake rules. |
Date: |
Sun, 5 Dec 2010 18:06:00 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Hello automakers.
I'm pinging this patch, according to:
<http://lists.gnu.org/archive/html/automake-patches/2010-11/msg00003.html>
I'll wait the customary 72 hours (until wednesday evening) before pushing.
The updated rebased patch is attached. In it I have:
- removed the overly hackish and complex tests remake2{a,b,c}.test,
introduced by the previous version of my patch; I'll hopefully
be able to find a saner way to improve coverage in that area (it
can always be done in a follow-up patch without problems);
- removed a uselessly-added "make distcheck" from `remake4.test';
- removed all usages of in-line shell commments in make rules (since
it turned out they're unportable to at least Tru64/OSF 5.1 make);
this affected only test `remake12.test';
- removed usages of `##' special automake comments which weren't on
lines of their own (this usage is not part of the automake API)
- added or extended comments for trickier tests;
- thrown in some micellanous minor improvements and simplifications.
Regards,
Stefano
From 204145d95659de85240ab916d775918781b911ba Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 13 Aug 2010 11:50:31 +0200
Subject: [PATCH] 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.
In heading comments, add reference to sister test remake1a.test.
* tests/remake3.test: Likewise (but with sister test being
remake3a.test).
* tests/remake2.test: Make grepping of `Makefile.in' slighty
stricter.
* 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: New test.
* 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.
---
ChangeLog | 35 +++++++++++
tests/Makefile.am | 13 ++++
tests/Makefile.in | 13 ++++
tests/remake.test | 21 ++++--
tests/remake10a.test | 108 ++++++++++++++++++++++++++++++++
tests/remake10b.test | 107 ++++++++++++++++++++++++++++++++
tests/remake10c.test | 112 ++++++++++++++++++++++++++++++++++
tests/remake11.test | 82 +++++++++++++++++++++++++
tests/remake12.test | 122 +++++++++++++++++++++++++++++++++++++
tests/remake1a.test | 59 ++++++++++++++++++
tests/remake2.test | 22 ++++---
tests/remake3.test | 18 +++--
tests/remake3a.test | 75 +++++++++++++++++++++++
tests/remake4.test | 6 +-
tests/remake5.test | 9 ++-
tests/remake6.test | 20 +++---
tests/remake7.test | 11 ++--
tests/remake8a.test | 163 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/remake8b.test | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/remake9a.test | 106 ++++++++++++++++++++++++++++++++
tests/remake9b.test | 108 ++++++++++++++++++++++++++++++++
tests/remake9c.test | 109 +++++++++++++++++++++++++++++++++
tests/remake9d.test | 109 +++++++++++++++++++++++++++++++++
23 files changed, 1553 insertions(+), 40 deletions(-)
create mode 100755 tests/remake10a.test
create mode 100755 tests/remake10b.test
create mode 100755 tests/remake10c.test
create mode 100755 tests/remake11.test
create mode 100755 tests/remake12.test
create mode 100755 tests/remake1a.test
create mode 100755 tests/remake3a.test
create mode 100755 tests/remake8a.test
create mode 100755 tests/remake8b.test
create mode 100755 tests/remake9a.test
create mode 100755 tests/remake9b.test
create mode 100755 tests/remake9c.test
create mode 100755 tests/remake9d.test
diff --git a/ChangeLog b/ChangeLog
index e8864f1..349057a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2010-12-05 Stefano Lattarini <address@hidden>
+
+ 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/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/remake.test: Enable `errexit' shell flag, and related
+ changes. Modernize `configure.in'. Add trailing `:' command.
+ In heading comments, add reference to sister test remake1a.test.
+ * tests/remake3.test: Likewise (but with sister test being
+ remake3a.test).
+ * tests/remake2.test: Make grepping of `Makefile.in' slighty
+ stricter.
+ * 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: New test.
+ * 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-11-25 Stefano Lattarini <address@hidden>
Fix spurious failures in `silent*.test' for $CC != gcc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..8b81932 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 de21f43..0d494e7 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 9c86b1b..48183bf 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
@@ -15,19 +16,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure remaking rules in subdir are correctly generated.
+# See also sister functional test `remake1b.test'.
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(sub/Makefile)
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
END
mkdir sub
: > 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 0000000..67b9e14
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat >> configure.in <<END
+m4_include([foo.m4])
+AC_SUBST([am_fingerprint], [m4_fingerprint])
+AC_OUTPUT
+END
+
+cat > 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'$(am_fingerprint)' = x'DummyValue'
+END
+
+echo 'm4_define([m4_fingerprint], [BadBadBad])' > foo.m4
+
+$sleep # so that generated autotools files will be older 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([m4_fingerprint], [$hash1])" > $top_srcdir/foo.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+
+ $sleep
+ echo "m4_define([m4_fingerprint], [$hash2])" > $top_srcdir/foo.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+
+ $sleep
+ echo "m4_include([bar.m4])" > $top_srcdir/foo.m4
+ echo "m4_define([m4_fingerprint], [$hash3])" > $top_srcdir/bar.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile && Exit 1
+ $FGREP $hash3 Makefile
+
+ $sleep
+ echo "m4_define([m4_fingerprint], [$hash1])" > $top_srcdir/bar.m4
+ $MAKE nil
+ $FGREP $hash2 Makefile && Exit 1
+ $FGREP $hash3 Makefile && Exit 1
+ $FGREP $hash1 Makefile
+
+ $sleep
+ echo "m4_define([m4_fingerprint], [DummyValue])" > $top_srcdir/foo.m4
+ $MAKE distcheck
+ $FGREP $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+ $FGREP $hash3 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 0000000..2e81db6
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+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'$(am_fingerprint)' = x'DummyValue'
+END
+
+echo 'am_fingerprint = BadBadBad' > foo.am
+
+$sleep # so that generated autotools files will be older 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 "am_fingerprint = $hash1" > $top_srcdir/foo.am
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+
+ $sleep
+ echo "am_fingerprint = $hash2" > $top_srcdir/foo.am
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+
+ $sleep
+ echo 'include $(top_srcdir)/bar.am' > $top_srcdir/foo.am
+ echo "am_fingerprint = $hash3" > $top_srcdir/bar.am
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile && Exit 1
+ $FGREP $hash3 Makefile
+
+ $sleep
+ echo "am_fingerprint = $hash1" > $top_srcdir/bar.am
+ $MAKE nil
+ $FGREP $hash2 Makefile && Exit 1
+ $FGREP $hash3 Makefile && Exit 1
+ $FGREP $hash1 Makefile
+
+ $sleep
+ echo "am_fingerprint = DummyValue" > $top_srcdir/foo.am
+ $MAKE distcheck
+ $FGREP $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+ $FGREP $hash3 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 0000000..98c13c5
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat >> configure.in <<END
+am_fingerprint='AM_FINGERPRINT'
+AC_SUBST([am_fingerprint])
+AC_OUTPUT
+END
+
+cat > 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'$(am_fingerprint)' = x'DummyValue'
+END
+
+mkdir m4
+echo 'AC_DEFUN([AM_FINGERPRINT], [BadBadBad])' > m4/foo.m4
+
+$sleep # so that generated autotools files will be older 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([AM_FINGERPRINT], [$hash1])" > $top_srcdir/m4/foo.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+
+ $sleep
+ echo "AC_DEFUN([AM_FINGERPRINT], [$hash2])" > $top_srcdir/m4/foo.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+
+ $sleep
+ echo "m4_include([m4/bar.m4])" > $top_srcdir/m4/foo.m4
+ echo "AC_DEFUN([AM_FINGERPRINT], [$hash3])" > $top_srcdir/m4/bar.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile && Exit 1
+ $FGREP $hash3 Makefile
+
+ $sleep
+ echo "AC_DEFUN([AM_FINGERPRINT], [$hash1])" > $top_srcdir/m4/bar.m4
+ $MAKE nil
+ $FGREP $hash2 Makefile && Exit 1
+ $FGREP $hash3 Makefile && Exit 1
+ $FGREP $hash1 Makefile
+
+ $sleep
+ echo "AC_DEFUN([AM_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 $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+ $FGREP $hash3 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 0000000..1038931
--- /dev/null
+++ b/tests/remake11.test
@@ -0,0 +1,82 @@
+#! /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 remake rules in deeply nested subdirectories,
+# and with a lot of files.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+ocwd=`pwd` || Exit 1
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+echo "AC_SUBST([FOO], [$hash1])" >> 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 "$hash1" $f
+done
+
+$sleep
+sed "s/$hash1/$hash2/" 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 "$hash2" $f
+done
+$FGREP "$hash1" 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 0000000..f031a96
--- /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 <http://www.gnu.org/licenses/>.
+
+# Test basic remake rules for Makefiles with non-default names
+# and/or with multiple sources.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([zardoz])
+AC_CONFIG_LINKS([Makefile:Makefile])
+AC_OUTPUT
+END
+
+cat > zardoz.am <<END
+EXTRA_DIST = Makefile
+#H: $hash1
+END
+
+cat > Makefile <<END
+include zardoz
+nil:
+.PHONY: nil
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE nil
+grep '^#H:' zardoz.in # for debugging
+$FGREP $hash1 zardoz
+$FGREP $hash1 zardoz.in
+$MAKE distcheck
+$MAKE distclean # this shouldn't remove Makefile
+ls -l
+test -f Makefile
+
+./configure
+
+$sleep
+sed "s/%HASH3%/$hash3/" >> 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'%HASH3%'
+test:
+ ls -l ;: for debugging
+ test x'$(FOO)' = x'dummy'
+.PHONY: test my-check
+END
+sed "s/^#H:.*/#H: $hash2/" 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 $hash1 zardoz zardoz.in && Exit 1
+$FGREP $hash2 zardoz
+$FGREP $hash2 zardoz.in
+
+./configure
+
+$sleep
+sed 's/^\(AC_CONFIG_FILES\)(.*/\1([zardoz:top.in:quux.in:bot.in])/' \
+ <configure.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 = $hash3" > bot.in
+$MAKE test
+$FGREP my-check zardoz # sanity check
+$FGREP $hash3 quux.in && Exit 1
+$FGREP $hash3 zardoz
+$FGREP $hash1 zardoz && Exit 1
+$FGREP $hash2 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 0000000..c0cf5c5
--- /dev/null
+++ b/tests/remake1a.test
@@ -0,0 +1,59 @@
+#! /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 remaking rules in subdir are correctly generated.
+# See also sister "grepping" test `remake.test'.
+
+. ./defs || Exit 1
+
+fingerprint='=/FiNgErPrInT/='
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+(cd sub && $MAKE -n) # sanity check
+
+# 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 3b63dea..0d8b5fe 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
@@ -18,16 +19,21 @@
. ./defs || Exit 1
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(sub/Makefile)
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
END
mkdir sub
: > 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 08ec16a..b330b07 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
@@ -15,13 +15,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure remaking rules work when there is no subdir Makefile.
+# 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 +31,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 0000000..90f5cbf
--- /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 <http://www.gnu.org/licenses/>.
+
+# Make sure remaking rules work when there is no subdir Makefile.
+# See also sister "grepping" test `remake3.test'.
+
+# NOTE: this test should work also without GNU make.
+. ./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 <<END
+check-local:
+ grep '%GrepMe%' sub/foo
+END
+$MAKE
+grep "grep '%GrepMe%' sub/foo" Makefile.in # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/remake4.test b/tests/remake4.test
index d6dbed7..0621c90 100755
--- a/tests/remake4.test
+++ b/tests/remake4.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -50,7 +50,9 @@ $MAKE
$sleep
touch aclocal.m4
$MAKE distdir
-cd remake4-1.0
+cd $me-1.0
test ! -f rebuild_ok
./configure
$MAKE
+
+:
diff --git a/tests/remake5.test b/tests/remake5.test
index d353632..133f9a0 100755
--- a/tests/remake5.test
+++ b/tests/remake5.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -25,7 +25,7 @@ set -e
cat >>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 a25e486..885bcb4 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 670f60b..66d4b9c 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 0000000..c94d151
--- /dev/null
+++ b/tests/remake8a.test
@@ -0,0 +1,163 @@
+#! /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 basic remake rules for Makefiles, for in-tree builds
+# Keep this in sync with sister test `remake8b.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+all-local: foo
+foo:
+ echo '!Foo!' >$@
+check-local:
+ cat foo
+ grep '!Foo!' foo
+CLEANFILES = foo
+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
+$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
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: quux
+check-local:
+ cat quux
+ grep '!Zardoz!' quux
+ test ! -r $(srcdir)/bar
+ test ! -r bar
+END
+
+mv -f $srcdir/configure.in configure.bak
+
+sed '/^AC_OUTPUT$/i\
+AC_CONFIG_FILES([quux])\
+AC_SUBST([QUUX], [Zardoz])' configure.bak >$srcdir/configure.in
+cat $srcdir/configure.in # for debugging
+
+cat > $srcdir/quux.in <<'END'
address@hidden@!
+END
+
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -f bar
+$MAKE distcheck
+
+rm -f quux
+$sleep
+
+mkdir $srcdir/m4
+: > $srcdir/acinclude.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
+
+$sleep
+sed '/^AC_OUTPUT$/i\
+AC_CONFIG_FILES([quux])\
+MY_CUSTOM_MACRO' configure.bak >$srcdir/configure.in
+cat $srcdir/configure.in # for debugging
+
+cat >> $srcdir/aclocal.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
+END
+
+$MAKE
+cat quux
+grep '%Foo%' quux
+$MAKE distcheck
+
+$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
+
+$sleep
+rm -f 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 0000000..96a82ae
--- /dev/null
+++ b/tests/remake8b.test
@@ -0,0 +1,165 @@
+#! /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 basic remake rules for Makefiles, for in-tree builds
+# Keep this in sync with sister test `remake8a.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+all-local: foo
+foo:
+ echo '!Foo!' >$@
+check-local:
+ cat foo
+ grep '!Foo!' foo
+CLEANFILES = foo
+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
+$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
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: quux
+check-local:
+ cat quux
+ grep '!Zardoz!' quux
+ test ! -r $(srcdir)/bar
+ test ! -r bar
+END
+
+mv -f $srcdir/configure.in configure.bak
+
+sed '/^AC_OUTPUT$/i\
+AC_CONFIG_FILES([quux])\
+AC_SUBST([QUUX], [Zardoz])' configure.bak >$srcdir/configure.in
+cat $srcdir/configure.in # for debugging
+
+cat > $srcdir/quux.in <<'END'
address@hidden@!
+END
+
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -f bar
+$MAKE distcheck
+
+rm -f quux
+$sleep
+
+mkdir $srcdir/m4
+: > $srcdir/acinclude.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
+
+$sleep
+sed '/^AC_OUTPUT$/i\
+AC_CONFIG_FILES([quux])\
+MY_CUSTOM_MACRO' configure.bak >$srcdir/configure.in
+cat $srcdir/configure.in # for debugging
+
+cat >> $srcdir/aclocal.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
+END
+
+$MAKE
+cat quux
+grep '%Foo%' quux
+$MAKE distcheck
+
+$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
+
+$sleep
+rm -f 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 0000000..1d714dd
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+am_fingerprint=BadBadBad
+AC_SUBST([am_fingerprint])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+$(srcdir)/configure.in: $(srcdir)/tweak-configure-in
+ $(SHELL) $(srcdir)/tweak-configure-in <$@ >address@hidden
+ mv -f address@hidden $@
+EXTRA_DIST = $(srcdir)/tweak-configure-in
+
+# Used by "make distcheck" later.
+check-local:
+ test x'$(am_fingerprint)' = x'DummyValue'
+ test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@am_fingerprint@'
+END
+
+echo cat > tweak-configure-in # no-op by default
+
+$sleep # so that generated autotools files will be older 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/^\\(am_fingerprint\\)=.*/\\1=$hash1/" $srcdir/configure.in >t
+ mv -f t $srcdir/configure.in
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+ test x"`./foo.sh`" = x"$hash1"
+
+ $sleep
+ echo 'sed "s/^\\(am_fingerprint\\)=.*/\\1='$hash2'/"' \
+ > $srcdir/tweak-configure-in
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+ test x"`./foo.sh`" = x"$hash2"
+
+ $sleep
+ echo cat > $srcdir/tweak-configure-in # no-op again
+ sed "s/^\\(am_fingerprint\\)=.*/\\1=DummyValue/" $srcdir/configure.in >t
+ mv -f t $srcdir/configure.in
+ $MAKE distcheck
+ $FGREP $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+
+ $MAKE distclean
+
+ cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9b.test b/tests/remake9b.test
new file mode 100755
index 0000000..041db04
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+am_fingerprint = BadBadBad
+
+all-local: nil
+nil: foo.sh
+.PHONY: nil
+
+$(srcdir)/Makefile.am: $(srcdir)/tweak-makefile-am
+ $(SHELL) $(srcdir)/tweak-makefile-am <$@ >address@hidden
+ mv -f address@hidden $@
+EXTRA_DIST = $(srcdir)/tweak-makefile-am
+
+foo.sh: Makefile
+ rm -f $@ address@hidden
+ echo '#!/bin/sh' > address@hidden
+ echo "echo '$(am_fingerprint)'" >> address@hidden
+ chmod a+x address@hidden && mv -f address@hidden $@
+CLEANFILES = foo.sh
+
+# Used by "make distcheck" later.
+check-local:
+ test x'$(am_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 older 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/^\\(am_fingerprint\\) *=.*/\\1 = $hash1/" $srcdir/Makefile.am >t
+ mv -f t $srcdir/Makefile.am
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+ test x"`./foo.sh`" = x"$hash1"
+
+ $sleep
+ echo 'sed "s/^\\(am_fingerprint\\) *=.*/\\1 = '$hash2'/"' \
+ > $srcdir/tweak-makefile-am
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+ test x"`./foo.sh`" = x"$hash2"
+
+ $sleep
+ echo cat > $srcdir/tweak-makefile-am # no-op again
+ sed "s/^\\(am_fingerprint\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am >t
+ mv -f t $srcdir/Makefile.am
+ $MAKE distcheck
+ $FGREP $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+
+ $MAKE distclean
+
+ cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9c.test b/tests/remake9c.test
new file mode 100755
index 0000000..ae9b91c
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+am_fingerprint='MY_FINGERPRINT'
+AC_SUBST([am_fingerprint])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > 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 <$@ >address@hidden
+ mv -f address@hidden $@
+ touch $@
+EXTRA_DIST = $(srcdir)/tweak-acinclude-m4
+
+# Used by "make distcheck" later.
+check-local:
+ test x'$(am_fingerprint)' = x'DummyValue'
+ test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@am_fingerprint@'
+END
+
+echo "AC_DEFUN([MY_FINGERPRINT], [BadBadBad])" > acinclude.m4
+
+echo : > tweak-acinclude-m4 # no-op by default
+
+$sleep # so that generated autotools files will be older 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], [$hash1])" > $srcdir/acinclude.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+ test x"`./foo.sh`" = x"$hash1"
+
+ $sleep
+ echo "echo 'AC_DEFUN([MY_FINGERPRINT], [$hash2])'" \
+ > $srcdir/tweak-acinclude-m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+ test x"`./foo.sh`" = x"$hash2"
+
+ $sleep
+ echo : > $srcdir/tweak-acinclude-m4 # no-op again
+ echo "AC_DEFUN([MY_FINGERPRINT], [DummyValue])" > $srcdir/acinclude.m4
+ $MAKE distcheck
+ $FGREP $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+
+ $MAKE distclean
+
+ cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9d.test b/tests/remake9d.test
new file mode 100755
index 0000000..4a44fba
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+am_fingerprint='MY_FINGERPRINT'
+AC_SUBST([am_fingerprint])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > 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 <$@ >address@hidden
+ mv -f address@hidden $@
+ touch $@
+EXTRA_DIST = $(srcdir)/tweak-aclocal-m4
+
+# Used by "make distcheck" later.
+check-local:
+ test x'$(am_fingerprint)' = x'DummyValue'
+ test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@am_fingerprint@'
+END
+
+echo cat > tweak-aclocal-m4 # no-op by default
+
+$sleep # so that generated autotools files will be older 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], [$hash1])dnl %%%" >> $srcdir/aclocal.m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile
+ test x"`./foo.sh`" = x"$hash1"
+
+ $sleep
+ echo "sed 's/.*dnl *%%%.*/AC_DEFUN([MY_FINGERPRINT], [$hash2])/'" \
+ > $srcdir/tweak-aclocal-m4
+ $MAKE nil
+ $FGREP am_fingerprint Makefile # for debugging
+ $FGREP $hash1 Makefile && Exit 1
+ $FGREP $hash2 Makefile
+ test x"`./foo.sh`" = x"$hash2"
+
+ $sleep
+ echo cat > $srcdir/tweak-aclocal-m4 # no-op again
+ echo 'AC_DEFUN([MY_FINGERPRINT], [DummyValue])' >> $srcdir/aclocal.m4
+ $MAKE distcheck
+ $FGREP $hash1 Makefile && Exit 1 # sanity check
+ $FGREP $hash2 Makefile && Exit 1 # likewise
+
+ $MAKE distclean
+
+ cd $srcdir
+
+done
+
+:
--
1.7.1
- Re: [PATCH] Extend checks on remake rules.,
Stefano Lattarini <=
- Re: [PATCH] Extend checks on remake rules., Ralf Wildenhues, 2010/12/05
- Re: [PATCH] Extend checks on remake rules., Stefano Lattarini, 2010/12/06
- Re: [PATCH] Extend checks on remake rules., Stefano Lattarini, 2010/12/12
- Re: [PATCH] Extend checks on remake rules., Ralf Wildenhues, 2010/12/15
- Re: [PATCH] Extend checks on remake rules., Stefano Lattarini, 2010/12/15
- Re: [PATCH] Extend checks on remake rules., Ralf Wildenhues, 2010/12/16
- Re: [PATCH] Extend checks on remake rules., Stefano Lattarini, 2010/12/16