[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoid certain spurious `testsuite' rebuilds
From: |
Noah Misch |
Subject: |
Re: Avoid certain spurious `testsuite' rebuilds |
Date: |
Wed, 5 Apr 2006 13:10:40 -0700 |
User-agent: |
Mutt/1.5.6i |
Hi Ralf, autoconf-patches,
On Sun, Apr 02, 2006 at 06:36:58PM +0200, Ralf Wildenhues wrote:
> > > * Noah Misch wrote on Fri, Mar 31, 2006 at 06:09:06PM CEST:
> > > > + test -f updated && mv -f updated $@; :
>
> Shouldn't that be
> test -f updated && mv -f updated $@ || :
>
> to cope with make implementations invoking `sh -e -c'?
The `:' was not necessary at all; I don't know why I left it there.
> Thanks. I guess it's ok to install. It still doesn't work with OpenBSD
> make though; I think it's because it does not check again that the
> stamp-tgat time is not updated after its rule is executed:
This could be same problem affecting FreeBSD make.
Removing tests/ac*.at from CVS had the virtue of revealing a bug in previous
iterations of this patch: when foo.at should be empty and there was no existing
foo.at, mktests.sh as patched would not create one.
Automake has a similar challenge: avoid rebuilding everything when `config.h.in'
or `config.status' changes, but the resulting `config.h' remains unchanged. Its
implementation is somewhat cleaner than mine, so I spent some time trying to
adapt it. I could not find a way to do so without precluding parallel make or
using one stamp file per lib/autoconf/*.m4. Even then, the optimization failed
on FreeBSD (as it does for Automake).
I substantially rewrote the patch. It's much simpler now, and the optimization
works with GNU, FreeBSD, NetBSD, Tru64, and HP-UX Make programs. It's broken
with respect to parallel make, but that's nothing new.
We now trigger the TESTSUITE_GENERATED_AT update from check-local, so `make -C
tests ./testsuite' may build a testsuite using out-of-date tests/ac*.at. I
couldn't find a way around this without introducing more serious flaws.
What do you think?
2006-04-05 Noah Misch <address@hidden>
Do not rebuild `testsuite' when a lib/autoconf/*.m4 edit does not affect
the generated test cases.
* tests/Makefile.am (stamp_tgat): New macro. Distribute.
(check_local): Depend on $(stamp_tgat).
(check_tgat): New macro, from old TESTSUITE_GENERATED_AT commands.
(stamp_tgat): New rule.
(TESTSUITE_GENERATED_AT): Remove prerequisites.
* tests/mktests: Only touch the products if they would change.
* tests/.cvsignore: Update.
diff -urp -X dontdiff ac-clean/tests/.cvsignore
ac-simplerer_ifchanged/tests/.cvsignore
--- ac-clean/tests/.cvsignore 2006-04-02 14:59:44.000000000 -0400
+++ ac-simplerer_ifchanged/tests/.cvsignore 2006-04-05 12:22:36.000000000
-0400
@@ -26,6 +26,7 @@ autoupdate
expr
ifnames
package.m4
+stamp-tgat
testsuite
testsuite.dir
wrapper.in
diff -urp -X dontdiff ac-clean/tests/Makefile.am
ac-simplerer_ifchanged/tests/Makefile.am
--- ac-clean/tests/Makefile.am 2006-03-06 16:13:22.000000000 -0500
+++ ac-simplerer_ifchanged/tests/Makefile.am 2006-04-05 15:51:40.000000000
-0400
@@ -1,7 +1,7 @@
## Process this file with automake to create Makefile.in. -*-Makefile-*-
## Makefile for Autoconf testsuite.
-## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
## Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
@@ -79,6 +79,10 @@ $(wrappers): wrapper.in
## Test suite. ##
## ------------ ##
+# Timestamp for TESTSUITE_GENERATED_AT.
+stamp_tgat = $(srcdir)/stamp-tgat
+EXTRA_DIST += $(stamp_tgat)
+
TESTSUITE_GENERATED_AT = \
$(srcdir)/aclang.at \
$(srcdir)/acc.at \
@@ -126,7 +130,7 @@ clean-local:
rm -f *.tmp
rm -f -r autom4te.cache
-check-local: atconfig atlocal $(TESTSUITE)
+check-local: atconfig atlocal $(stamp_tgat) $(TESTSUITE)
$(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
# Run the test suite on the *installed* tree.
@@ -161,9 +165,17 @@ AUTOCONF_FILES = $(autoconfdir)/general.
$(autoconfdir)/types.m4 \
$(autoconfdir)/programs.m4
-$(TESTSUITE_GENERATED_AT): mktests.sh $(AUTOCONF_FILES)
- cd $(srcdir) && ./mktests.sh \
- `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
+check_tgat = cd $(srcdir) && ./mktests.sh \
+ `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
+
+## Check and possibly update TESTSUITE_GENERATED_AT when AUTOCONF_FILES change.
+$(stamp_tgat): mktests.sh $(AUTOCONF_FILES)
+ $(check_tgat)
+ echo 'Timestamp for validation of tests/ac*at.' >$@
+
+## Rebuild missing TESTSUITE_GENERATED_AT.
+$(TESTSUITE_GENERATED_AT):
+ $(check_tgat)
## maintainer-check ##
diff -urp -X dontdiff ac-clean/tests/mktests.sh
ac-simplerer_ifchanged/tests/mktests.sh
--- ac-clean/tests/mktests.sh 2006-04-04 15:42:35.000000000 -0400
+++ ac-simplerer_ifchanged/tests/mktests.sh 2006-04-05 15:17:04.000000000
-0400
@@ -262,12 +262,20 @@ MK_EOF
# preserves the old version of the file. If there is nothing to
# check, output /rien du tout/[1].
if grep AT_CHECK ac$base.tat >/dev/null 2>&1; then
- mv -f ac$base.tat ac$base.at
- # Help people not to update these files by hand.
- chmod a-w ac$base.at
+ if diff ac$base.at ac$base.tat >/dev/null 2>&1; then
+ rm -f ac$base.tat
+ else
+ diff ac$base.at ac$base.tat || :
+ mv -f ac$base.tat ac$base.at
+ # Help people not to update these files by hand.
+ chmod a-w ac$base.at
+ fi
else
- rm -f ac$base.tat ac$base.at
- touch ac$base.at
+ rm -f ac$base.tat
+ if test \! -f ac$base.at || test -s ac$base.at; then
+ rm -f ac$base.at
+ touch ac$base.at
+ fi
fi
done