automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Extend checks on remake rules.


From: Ralf Wildenhues
Subject: Re: [PATCH] Extend checks on remake rules.
Date: Wed, 15 Dec 2010 21:46:56 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

* Stefano Lattarini wrote on Mon, Dec 06, 2010 at 08:34:04PM CET:
> On Sunday 05 December 2010, Ralf Wildenhues wrote:
> > Some of the tests look like they are testing the same things really
> > as other new or existing tests.
> >
> Maybe, but I prefer to have some overlaps between different tests rather
> than a lack in coverage.  Also, different tests might check the same
> feature in slightly different situations, so that the overlapping is only
> partial anyway, and the increase in coverage is real (albeit small).

Hmm, ok.

> > Can you explain them (ideally, the
> > comment at the start of the test should be unique for each test so
> > we can infer from that that each of the tests is actually required)?
> >
> I've tried to improve some heading comments (see the attached
> squash-in); please tell me if now they seem clearer now.  Also,
> Maybe I should expand comments in tests remake9*.tes toot, but
> I haven't yet figured it out how to do so without being quite
> verbose.  Hmm, but maybe here being verbose is the right thing
> to do after all...  WDYT?

I like the new comments better, thanks.

> In the process, I've also made a couple of small improvements and
> fixes to remake8{a,b}.test; please check them out and tell me if
> you're OK with them.

See inline comments.  Patch is ok after addressing them.

Thanks,
Ralf

> 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

slightly

> 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.


> --- /dev/null
> +++ b/tests/remake10a.test
> @@ -0,0 +1,108 @@

> +# 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

By the way, why all these hash values (here and in other tests)?  Is
there any significance to their values?  Why not some less random
string?

And in other tests, you use %GrepMe%, !Foo! and other magic strings.
Why all the variation in these?  That makes the tests harder to read.

> +cat >> configure.in <<END
> +m4_include([foo.m4])
> +AC_SUBST([am_fingerprint], [m4_fingerprint])

Why invade both Automake and M4sh namespaces here?

> +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'

Why do you quote DummyValue here?  The leading x should not be needed on
either side.  (several instances below)

> +END
> +
> +echo 'm4_define([m4_fingerprint], [BadBadBad])' > foo.m4
> +
> +$sleep # so that generated autotools files will be older than prerequisites

s/older/newer/ ?

More instances below.  Copy and paste bad.  ;-)

> +$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
> +
> +:

> --- /dev/null
> +++ b/tests/remake10b.test
> @@ -0,0 +1,107 @@

> +
> +# 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
> +
> +:

> --- /dev/null
> +++ b/tests/remake10c.test
> @@ -0,0 +1,112 @@

> +# 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

Invasion of Automake namespace.

> +
> +$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
> +
> +:


> --- /dev/null
> +++ b/tests/remake8a.test
> @@ -0,0 +1,193 @@

> +# Test basic remake rules for Makefiles, for an *in-tree build*.
> +# This testcase checks dependency of generated Makefile from Makefile.am,
> +# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
> +# by aclocal.
> +# Keep this in sync with sister test `remake8b.test', which performs the
> +# same checks for a VPATH build.

Why not do both in one test?  You do that elsewhere already.
Oh well.  The lots of duplication is a bit not so nice for
maintenance (and for review; and karma) ...

> +required=GNUmake
> +. ./defs || Exit 1
> +
> +set -e
> +
> +mv -f configure.in configure.stub
> +
> +cat > Makefile.am <<'END'
> +all-local: foo
> +foo:
> +     echo '!Foo!' >$@
> +check-local:
> +     cat foo
> +     grep '!Foo!' foo
> +CLEANFILES = foo
> +END
> +
> +cat configure.stub - > configure.in <<'END'
> +AC_OUTPUT
> +END
> +
> +$ACLOCAL
> +$AUTOCONF
> +$AUTOMAKE
> +
> +srcdir='.' # to make syncing with remake8b.test easier.
> +
> +$srcdir/configure
> +
> +$MAKE
> +cat foo
> +grep '!Foo!' foo
> +$MAKE distcheck
> +
> +rm -f foo
> +
> +# Modify just Makefile.am.
> +
> +$sleep
> +
> +cat > $srcdir/Makefile.am <<'END'
> +all-local: bar
> +bar:
> +     echo '!Baz!' >$@
> +check-local:
> +     cat bar
> +     grep '!Baz!' bar
> +     test ! -r $(srcdir)/foo
> +     test ! -r foo
> +CLEANFILES = bar
> +END
> +
> +$MAKE
> +cat bar
> +grep '!Baz!' bar
> +test ! -r foo
> +$MAKE distcheck
> +
> +rm -f bar
> +
> +# Modify Makefile.am and configure.in.
> +
> +$sleep
> +
> +cat > $srcdir/Makefile.am <<'END'
> +all-local: quux
> +check-local:
> +     cat quux
> +     grep '!Zardoz!' quux
> +     test ! -r $(srcdir)/bar
> +     test ! -r bar
> +END
> +
> +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
> +AC_CONFIG_FILES([quux])
> +AC_SUBST([QUUX], [Zardoz])
> +AC_OUTPUT
> +END
> +
> +cat > $srcdir/quux.in <<'END'
> address@hidden@!
> +END
> +
> +$MAKE
> +cat quux
> +grep '!Zardoz!' quux
> +test ! -f bar
> +$MAKE distcheck
> +
> +rm -f quux
> +
> +# Modify Makefile.am to add a directory of extra m4 files
> +# considered by aclocal.
> +
> +$sleep
> +
> +mkdir $srcdir/m4
> +
> +cat > $srcdir/Makefile.am <<'END'
> +ACLOCAL_AMFLAGS = -I m4
> +all-local: quux
> +check-local:
> +     cat quux
> +     grep '%Foo%' quux
> +     test x'$(QUUX)' = x'%Foo%'
> +END
> +
> +$MAKE # this should place aclocal flags in Makefile
> +grep '.*-I m4' Makefile # sanity check
> +
> +# Modify configure.in and aclocal.m4.
> +
> +$sleep
> +
> +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
> +AC_CONFIG_FILES([quux])
> +MY_CUSTOM_MACRO
> +AC_OUTPUT
> +END
> +
> +cat >> $srcdir/aclocal.m4 <<'END'
> +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
> +END
> +
> +$MAKE
> +cat quux
> +grep '%Foo%' quux
> +$MAKE distcheck
> +
> +# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
> +# the directory of extra m4 files considered by aclocal.  This new
> +# file should now provide a macro required by configure.in and that
> +# was previously provided by aclocal.m4.
> +
> +$sleep
> +
> +sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
> +mv -f t $srcdir/Makefile.am
> +cat $srcdir/Makefile.am
> +rm -f $srcdir/aclocal.m4
> +cat > $srcdir/m4/blah.m4 <<'END'
> +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])])
> +END
> +
> +$MAKE
> +cat quux
> +grep '%Bar%' quux
> +$MAKE distcheck
> +
> +# Modify Makefile.am, remove all the extra m4 files to considered
> +# by aclocal, and add an acinclude.m4 file.  This last file should
> +# now provide a macro required by configure.in, and that was
> +# previously provided by the extra m4 files considered by aclocal.
> +
> +$sleep
> +
> +rm -f $srcdir/m4/*.m4
> +sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
> +mv -f t $srcdir/Makefile.am
> +cat $srcdir/Makefile.am
> +cat > $srcdir/acinclude.m4 <<'END'
> +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])])
> +END
> +
> +$MAKE
> +cat quux
> +grep '%Quux%' quux
> +$MAKE distcheck
> +
> +:
> diff --git a/tests/remake8b.test b/tests/remake8b.test
> new file mode 100755
> index 0000000..3861326
> --- /dev/null
> +++ b/tests/remake8b.test
> @@ -0,0 +1,195 @@
> +#! /bin/sh
> +# Copyright (C) 2010 Free Software Foundation, Inc.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2, or (at your option)
> +# any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +# Test basic remake rules for Makefiles, for a *VPATH build*.
> +# This testcase checks dependency of generated Makefile from Makefile.am,
> +# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
> +# by aclocal.
> +# Keep this in sync with sister test `remake8a.test', which performs the
> +# same checks for a in-tree build.
> +
> +required=GNUmake
> +. ./defs || Exit 1
> +
> +set -e
> +
> +mv -f configure.in configure.stub
> +
> +cat > Makefile.am <<'END'
> +all-local: foo
> +foo:
> +     echo '!Foo!' >$@
> +check-local:
> +     cat foo
> +     grep '!Foo!' foo
> +CLEANFILES = foo
> +END
> +
> +cat configure.stub - > configure.in <<'END'
> +AC_OUTPUT
> +END
> +
> +$ACLOCAL
> +$AUTOCONF
> +$AUTOMAKE
> +
> +mkdir build
> +cd build
> +srcdir='..' # to make syncing with remake8a.test easier.
> +
> +$srcdir/configure
> +
> +$MAKE
> +cat foo
> +grep '!Foo!' foo
> +$MAKE distcheck
> +
> +rm -f foo
> +
> +# Modify just Makefile.am.
> +
> +$sleep
> +
> +cat > $srcdir/Makefile.am <<'END'
> +all-local: bar
> +bar:
> +     echo '!Baz!' >$@
> +check-local:
> +     cat bar
> +     grep '!Baz!' bar
> +     test ! -r $(srcdir)/foo
> +     test ! -r foo
> +CLEANFILES = bar
> +END
> +
> +$MAKE
> +cat bar
> +grep '!Baz!' bar
> +test ! -r foo
> +$MAKE distcheck
> +
> +rm -f bar
> +
> +# Modify Makefile.am and configure.in.
> +
> +$sleep
> +
> +cat > $srcdir/Makefile.am <<'END'
> +all-local: quux
> +check-local:
> +     cat quux
> +     grep '!Zardoz!' quux
> +     test ! -r $(srcdir)/bar
> +     test ! -r bar
> +END
> +
> +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
> +AC_CONFIG_FILES([quux])
> +AC_SUBST([QUUX], [Zardoz])
> +AC_OUTPUT
> +END
> +
> +cat > $srcdir/quux.in <<'END'
> address@hidden@!
> +END
> +
> +$MAKE
> +cat quux
> +grep '!Zardoz!' quux
> +test ! -f bar
> +$MAKE distcheck
> +
> +rm -f quux
> +
> +# Modify Makefile.am to add a directory of extra m4 files
> +# considered by aclocal.
> +
> +$sleep
> +
> +mkdir $srcdir/m4
> +
> +cat > $srcdir/Makefile.am <<'END'
> +ACLOCAL_AMFLAGS = -I m4
> +all-local: quux
> +check-local:
> +     cat quux
> +     grep '%Foo%' quux
> +     test x'$(QUUX)' = x'%Foo%'
> +END
> +
> +$MAKE # this should place aclocal flags in Makefile
> +grep '.*-I m4' Makefile # sanity check
> +
> +# Modify configure.in and aclocal.m4.
> +
> +$sleep
> +
> +cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
> +AC_CONFIG_FILES([quux])
> +MY_CUSTOM_MACRO
> +AC_OUTPUT
> +END
> +
> +cat >> $srcdir/aclocal.m4 <<'END'
> +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
> +END
> +
> +$MAKE
> +cat quux
> +grep '%Foo%' quux
> +$MAKE distcheck
> +
> +# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
> +# the directory of extra m4 files considered by aclocal.  This new
> +# file should now provide a macro required by configure.in and that
> +# was previously provided by aclocal.m4.
> +
> +$sleep
> +
> +sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
> +mv -f t $srcdir/Makefile.am
> +cat $srcdir/Makefile.am
> +rm -f $srcdir/aclocal.m4
> +cat > $srcdir/m4/blah.m4 <<'END'
> +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])])
> +END
> +
> +$MAKE
> +cat quux
> +grep '%Bar%' quux
> +$MAKE distcheck
> +
> +# Modify Makefile.am, remove all the extra m4 files to considered
> +# by aclocal, and add an acinclude.m4 file.  This last file should
> +# now provide a macro required by configure.in, and that was
> +# previously provided by the extra m4 files considered by aclocal.
> +
> +$sleep
> +
> +rm -f $srcdir/m4/*.m4
> +sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
> +mv -f t $srcdir/Makefile.am
> +cat $srcdir/Makefile.am
> +cat > $srcdir/acinclude.m4 <<'END'
> +AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])])
> +END
> +
> +$MAKE
> +cat quux
> +grep '%Quux%' quux
> +$MAKE distcheck
> +
> +:
> diff --git a/tests/remake9a.test b/tests/remake9a.test
> new file mode 100755
> index 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..19bd1f1
> --- /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 acinclude.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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]