[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Extend checks on remake rules.
From: |
Stefano Lattarini |
Subject: |
[PATCH] Extend checks on remake rules. |
Date: |
Tue, 24 Aug 2010 00:29:59 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Hello automakers.
While hacking the patch series "Add support for non-default autotools
in rebuild rules", I noticed that the coverage of remake rules in
tests `remake*.test' is pretty weak. This patch (for maint) should
improve the situation.
IMO more tests for maintaner-mode are needed as well, but this is
material for another patch.
Regards,
Stefano
From c75f61c534f0cde41ea8cbb4d57bdf4cb2c60e44 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 13 Aug 2010 11:50:31 +0200
Subject: [PATCH] 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.
* tests/remake4.test: Likewise, and 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 remake1b.test.
* tests/remake3.test: Likewise (but with sister test being
remake3a.test).
* tests/remake2.test: Likewise (but with sister test being
remake2a.test). Also, make grepping of `Makefile.in' slighty
stricter.
* tests/remake1a.test: New test, sister of remake.test.
* tests/remake2a.test: New test, related to remake2.test.
* tests/remake2b.test: New test, sister of remake2a.test.
* tests/remake2c.test: Likewise.
* tests/remake3a.test: New test, sister of remake3.test.
* tests/remake8.test: New test.
* tests/remake9a.test: Likewise.
* tests/remake9b.test: Likewise.
* tests/remake9c.test: Likewise.
* tests/remake10a.test: Likewise.
* tests/remake10b.test: Likewise.
* tests/remake10c.test: Likewise.
* tests/remake11.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
ChangeLog | 37 ++++++++++++
tests/Makefile.am | 13 ++++
tests/Makefile.in | 13 ++++
tests/remake.test | 21 +++++--
tests/remake10a.test | 108 +++++++++++++++++++++++++++++++++
tests/remake10b.test | 107 +++++++++++++++++++++++++++++++++
tests/remake10c.test | 111 ++++++++++++++++++++++++++++++++++
tests/remake11.test | 82 +++++++++++++++++++++++++
tests/remake1a.test | 53 +++++++++++++++++
tests/remake2.test | 23 +++++---
tests/remake2a.test | 118 +++++++++++++++++++++++++++++++++++++
tests/remake2b.test | 137 ++++++++++++++++++++++++++++++++++++++++++
tests/remake2c.test | 126 +++++++++++++++++++++++++++++++++++++++
tests/remake3.test | 18 ++++--
tests/remake3a.test | 75 +++++++++++++++++++++++
tests/remake4.test | 8 ++-
tests/remake5.test | 6 ++-
tests/remake6.test | 20 ++++---
tests/remake7.test | 11 ++--
tests/remake8.test | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/remake9a.test | 106 +++++++++++++++++++++++++++++++++
tests/remake9b.test | 108 +++++++++++++++++++++++++++++++++
tests/remake9c.test | 108 +++++++++++++++++++++++++++++++++
23 files changed, 1530 insertions(+), 39 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/remake1a.test
create mode 100755 tests/remake2a.test
create mode 100755 tests/remake2b.test
create mode 100755 tests/remake2c.test
create mode 100755 tests/remake3a.test
create mode 100755 tests/remake8.test
create mode 100755 tests/remake9a.test
create mode 100755 tests/remake9b.test
create mode 100755 tests/remake9c.test
diff --git a/ChangeLog b/ChangeLog
index 98011dc..17c4d9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2010-08-23 Stefano Lattarini <address@hidden>
+
+ 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.
+ * tests/remake4.test: Likewise, and 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 remake1b.test.
+ * tests/remake3.test: Likewise (but with sister test being
+ remake3a.test).
+ * tests/remake2.test: Likewise (but with sister test being
+ remake2a.test). Also, make grepping of `Makefile.in' slighty
+ stricter.
+ * tests/remake1a.test: New test, sister of remake.test.
+ * tests/remake2a.test: New test, related to remake2.test.
+ * tests/remake2b.test: New test, sister of remake2a.test.
+ * tests/remake2c.test: Likewise.
+ * tests/remake3a.test: New test, sister of remake3.test.
+ * tests/remake8.test: New test.
+ * tests/remake9a.test: Likewise.
+ * tests/remake9b.test: Likewise.
+ * tests/remake9c.test: Likewise.
+ * tests/remake10a.test: Likewise.
+ * tests/remake10b.test: Likewise.
+ * tests/remake10c.test: Likewise.
+ * tests/remake11.test: Likewise.
+ * tests/Makefile.am (TESTS): Updated.
+
2010-08-21 Ralf Wildenhues <address@hidden>
Improve robustness of mdate-sh script.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3ecc341..54234c2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -596,12 +596,25 @@ python12.test \
recurs.test \
recurs2.test \
remake.test \
+remake1a.test \
remake2.test \
+remake2a.test \
+remake2b.test \
+remake2c.test \
remake3.test \
+remake3a.test \
remake4.test \
remake5.test \
remake6.test \
remake7.test \
+remake8.test \
+remake9a.test \
+remake9b.test \
+remake9c.test \
+remake10a.test \
+remake10b.test \
+remake10c.test \
+remake11.test \
regex.test \
req.test \
reqd.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 4671ad0..73188be 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -834,12 +834,25 @@ python12.test \
recurs.test \
recurs2.test \
remake.test \
+remake1a.test \
remake2.test \
+remake2a.test \
+remake2b.test \
+remake2c.test \
remake3.test \
+remake3a.test \
remake4.test \
remake5.test \
remake6.test \
remake7.test \
+remake8.test \
+remake9a.test \
+remake9b.test \
+remake9c.test \
+remake10a.test \
+remake10b.test \
+remake10c.test \
+remake11.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..7e02888
--- /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 $hash3 Makefile && Exit 1
+ $FGREP $hash2 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..2981588
--- /dev/null
+++ b/tests/remake10c.test
@@ -0,0 +1,111 @@
+#! /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
+ : > $top_srcdir/m4/bar.m4 # yep, clobber, don't remove
+ $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/remake1a.test b/tests/remake1a.test
new file mode 100755
index 0000000..a43269f
--- /dev/null
+++ b/tests/remake1a.test
@@ -0,0 +1,53 @@
+#! /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'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+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
+
+$sleep
+cat > Makefile.am <<'END'
+ok:
+ echo 'Good!' >$@
+END
+$MAKE ok
+grep 'Good!' ok
+
+:
diff --git a/tests/remake2.test b/tests/remake2.test
index 3b63dea..b6e7d92 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
@@ -15,19 +16,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure remaking rules in subdir are correct.
+# See also sister functional test `remake2a'.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 '\$(AUTOMAKE).*sub/Makefile' sub/Makefile.in
-grep 'AUTOMAKE.*sub/Makefile' sub/Makefile.in
+:
diff --git a/tests/remake2a.test b/tests/remake2a.test
new file mode 100755
index 0000000..b7a95eb
--- /dev/null
+++ b/tests/remake2a.test
@@ -0,0 +1,118 @@
+#! /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 correct.
+# Keep this in sync with sister tests remake2{b,c}.test.
+
+required=GNUmake
+. ./defs || Exit 1
+
+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
+
+cat > wrap-automake <<'END'
+#!/bin/sh
+set -e
+if test ! -f am.out; then
+ echo '0' > am.out
+fi
+i=`sed -n 1p am.out`
+i=`expr $i + 1`
+sed -e "1s/.*/$i/" am.out > am.tmp
+mv -f am.tmp am.out
+for x
+do
+ echo "!$x!" >>am.out || exit 1
+done
+END
+echo "exec $AUTOMAKE" '${1+"$@"}' >> wrap-automake
+chmod a+x wrap-automake
+
+ocwd=`pwd`
+
+#
+# Three subroutines useful to avoid code duplication.
+# Use "&&" list to avoid problems with shells with broken `set -e'.
+#
+
+am_remake_sub()
+{
+ cd sub \
+ && AUTOMAKE="$ocwd/wrap-automake" $MAKE -e \
+ && cd .. \
+ || Exit 1
+}
+
+# Usage: check_remade TOP-SRCDIR [SUBDIR]
+check_remade()
+{
+ test -n "$1" || Exit 99 # sanity check
+ # Use "&&" list to avoid problems with shells with broken `set -e'.
+ f=$1/am.out \
+ && s=${2+"$2/"} \
+ && cat $f \
+ && grep "^!${s}Makefile!$" $f \
+ && test 1 = `sed -n 1p $f` \
+ && test `grep -c '^![^-]' $f` -eq 1 \
+ && rm -f $f \
+ || Exit 1
+}
+
+# Usage: check_not_remade TOP-SRCDIR
+check_not_remade()
+{
+ test -n "$1" || Exit 99 # sanity check
+ test ! -r $1/am.out || Exit 1
+}
+
+#
+# Go with tests.
+#
+
+mkdir build # for the VAPTH build
+
+# Try with VPATH build first, then in-tree build.
+for srcdir in '..' '.'; do
+
+ test x"$srcdir" = x"." || cd build || Exit 1
+ $srcdir/configure
+
+ $sleep
+ touch $srcdir/sub/Makefile.am
+ am_remake_sub
+ check_remade $srcdir 'sub'
+ $sleep
+ am_remake_sub
+ check_not_remade $srcdir
+
+ cd $srcdir
+
+done
+
+:
diff --git a/tests/remake2b.test b/tests/remake2b.test
new file mode 100755
index 0000000..9a74ff6
--- /dev/null
+++ b/tests/remake2b.test
@@ -0,0 +1,137 @@
+#! /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/>.
+
+# Check that remaking rules do not run automake on more files than
+# necessary.
+# Keep this in sync with sister tests remake2{a,c}.test.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cat > wrap-automake <<'END'
+#!/bin/sh
+set -e
+if test ! -f am.out; then
+ echo '0' > am.out
+fi
+i=`sed -n 1p am.out`
+i=`expr $i + 1`
+sed -e "1s/.*/$i/" am.out > am.tmp
+mv -f am.tmp am.out
+for x
+do
+ echo "!$x!" >>am.out || exit 1
+done
+END
+echo "exec $AUTOMAKE" '${1+"$@"}' >> wrap-automake
+chmod a+x wrap-automake
+
+ocwd=`pwd`
+
+#
+# Three subroutines useful to avoid code duplication.
+#
+
+am_remake()
+{
+ AUTOMAKE="$ocwd/wrap-automake" $MAKE -e || Exit 1
+}
+
+# Usage: check_remade TOP-SRCDIR [SUBDIR]
+check_remade()
+{
+ test -n "$1" || Exit 99 # sanity check
+ # Use "&&" list to avoid problems with shells with broken `set -e'.
+ f=$1/am.out \
+ && s=${2+"$2/"} \
+ && cat $f \
+ && grep "^!${s}Makefile!$" $f \
+ && test 1 = `sed -n 1p $f` \
+ && test `grep -c '^![^-]' $f` -eq 1 \
+ && rm -f $f \
+ || Exit 1
+}
+
+# Usage: check_not_remade TOP-SRCDIR
+check_not_remade()
+{
+ test -n "$1" || Exit 99 # sanity check
+ test ! -r $1/am.out || Exit 1
+}
+
+#
+# Go with tests.
+#
+
+mkdir build # for the VAPTH build
+
+# Try with VPATH build first, then in-tree build.
+for srcdir in '..' '.'; do
+
+ test x"$srcdir" = x"." || cd build || Exit 1
+ $srcdir/configure
+
+ cd sub
+ $sleep
+ touch $srcdir/../sub/Makefile.am
+ am_remake
+ check_remade $srcdir/.. 'sub'
+ $sleep
+ am_remake
+ check_not_remade $srcdir/..
+
+ cd ..
+ $sleep
+ touch $srcdir/Makefile.am
+ am_remake
+ check_remade $srcdir
+ $sleep
+ am_remake
+ check_not_remade $srcdir
+
+ $sleep
+ touch $srcdir/sub/Makefile.am
+ am_remake
+ check_remade $srcdir 'sub'
+ $sleep
+ am_remake
+ check_not_remade $srcdir
+
+ cd $srcdir
+
+done
+
+$MAKE distcheck
+
+:
diff --git a/tests/remake2c.test b/tests/remake2c.test
new file mode 100755
index 0000000..a142261
--- /dev/null
+++ b/tests/remake2c.test
@@ -0,0 +1,126 @@
+#! /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/>.
+
+# Check that remaking rules do not run automake more times than
+# necessary.
+# Keep this in sync with sister tests remake2{a,b}.test.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cat > wrap-automake <<'END'
+#!/bin/sh
+set -e
+if test ! -f am.out; then
+ echo '0' > am.out
+fi
+i=`sed -n 1p am.out`
+i=`expr $i + 1`
+sed -e "1s/.*/$i/" am.out > am.tmp
+mv -f am.tmp am.out
+for x
+do
+ echo "!$x!" >>am.out || exit 1
+done
+END
+echo "exec $AUTOMAKE" '${1+"$@"}' >> wrap-automake
+chmod a+x wrap-automake
+
+ocwd=`pwd`
+
+#
+# Three subroutines useful to avoid code duplication.
+#
+
+am_remake()
+{
+ AUTOMAKE="$ocwd/wrap-automake" $MAKE -e || Exit 1
+}
+
+# Usage: check_remade TOP-SRCDIR
+check_remade()
+{
+ test -n "$1" || Exit 99 # sanity check
+ # Explicit "Exit" to avoid problems with shells with broken `set -e'.
+ f=$1/am.out
+ cat $f || Exit 1
+ grep '![^-]' $f && Exit 1
+ grep 'akefile' $f && Exit 1
+ test 1 = `sed -n 1p $f` || Exit 1
+ rm -f $f || Exit 1
+}
+
+# Usage: check_not_remade TOP-SRCDIR
+check_not_remade()
+{
+ test -n "$1" || Exit 99 # sanity check
+ test ! -r $1/am.out || Exit 1
+}
+
+#
+# Go with tests.
+#
+
+mkdir build # for the VAPTH build
+
+# Try with VPATH build first, then in-tree build.
+for srcdir in '..' '.'; do
+
+ test x"$srcdir" = x"." || cd build || Exit 1
+ $srcdir/configure
+
+ $sleep
+ touch $srcdir/configure.in
+ am_remake
+ check_remade $srcdir
+ $sleep
+ am_remake
+ check_not_remade $srcdir
+ cd sub
+ $sleep
+ touch $srcdir/../configure.in
+ am_remake
+ check_remade $srcdir/..
+ $sleep
+ am_remake
+ check_not_remade $srcdir/..
+ cd ..
+
+ cd $srcdir
+
+done
+
+$MAKE distcheck
+
+:
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..345fb8b
--- /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 `remake3b.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..c1c8bd1 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,11 @@ $MAKE
$sleep
touch aclocal.m4
$MAKE distdir
-cd remake4-1.0
+cd $me-1.0
test ! -f rebuild_ok
./configure
$MAKE
+
+$MAKE distcheck
+
+:
diff --git a/tests/remake5.test b/tests/remake5.test
index d353632..c52be7c 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
@@ -70,3 +70,7 @@ $sleep
echo 'AC_SUBST([YIPPY_YIPPY_YEAH])' >foo.m4
$MAKE
grep YIPPY_YIPPY_YEAH Makefile
+
+$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/remake8.test b/tests/remake8.test
new file mode 100755
index 0000000..0783823
--- /dev/null
+++ b/tests/remake8.test
@@ -0,0 +1,160 @@
+#! /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.
+
+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
+
+./configure
+
+$MAKE
+cat foo
+grep '!Foo!' foo
+$MAKE distcheck
+
+rm -f foo
+$sleep
+
+cat > 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 > Makefile.am <<'END'
+all-local: quux
+check-local:
+ cat quux
+ grep '!Zardoz!' quux
+ test ! -r $(srcdir)/bar
+ test ! -r bar
+END
+
+mv -f configure.in configure.bak
+
+sed '/^AC_OUTPUT$/i\
+AC_CONFIG_FILES([quux])\
+AC_SUBST([QUUX], [Zardoz])' configure.bak >configure.in
+cat configure.in # for debugging
+
+cat > quux.in <<END
address@hidden@!
+END
+
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -f bar
+$MAKE distcheck
+
+rm -f quux
+$sleep
+
+mkdir m4
+: > acinclude.m4
+
+cat > 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 >configure.in
+cat configure.in # for debugging
+
+cat >> 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' Makefile.am > t
+mv -f t Makefile.am
+cat Makefile.am
+rm -f aclocal.m4
+cat > 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' Makefile.am > t
+mv -f t Makefile.am
+cat Makefile.am
+cat > 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..fcf03a9
--- /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 sister tests `remake9b.test' and `remake9c.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..266c5c7
--- /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 sister tests `remake9a.test' and `remake9c.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..75efd6e
--- /dev/null
+++ b/tests/remake9c.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 aclocal.m4 or its prerequisites change.
+# Keep in sync with sister tests `remake9a.test' and `remake9b.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 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 cat > 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
+
+:
--
1.7.1
- [PATCH] Extend checks on remake rules.,
Stefano Lattarini <=