On Monday 29 November 2010, Ralf Wildenhues wrote: > * Stefano Lattarini wrote on Thu, Nov 25, 2010 at 02:37:28PM CET: > > The attached patch is based off of maint, and intended for master. > > OK to apply? > > With nits addressed. > > Thanks, > Ralf > > > Improve and extend tests on `:=' variable assignments. > > > > * tests/colneq.test: Avoid useless use of wildcards and extra > > variable assignments in Makefile.am. Use command-line automake > > options instead of editing AUTOMAKE_OPTIONS in Makefile.am. > > Make grepping of the generated Makefile.in slightly stricter. > > Add a trailing `:' command. > > * tests/colneq.test: Avoid useless use of EXTRA_DIST special > > variable in Makefile.am. Do not create dummy files which are > > not needed anymore. Also run autoconf, ./configure and make. > > Add a trailing `:' command. > > * tests/colneq3.test: New test, similar to colneq.test, but > > running ./configure and make. > > * tests/Makefile.am (TESTS): Update. > > > --- a/tests/colneq.test > > +++ b/tests/colneq.test > > > @@ -21,14 +22,14 @@ > > set -e > > > > cat > Makefile.am << 'END' > > -ICONS := $(wildcard *.xbm) > > Please leave the wildcard line in. Removing it makes assumptions about > the parser. > OK. > > --- a/tests/colneq2.test > > +++ b/tests/colneq2.test > > @@ -20,14 +20,23 @@ > > > > set -e > > > > +cat >> configure.in << 'END' > > +AC_OUTPUT > > +END > > + > > cat > Makefile.am << 'END' > > t = a b c > > -EXTRA_DIST = $(t:=.test) > > Please leave the EXTRA_DIST line in. It is something different if > automake skips a normal variable containing this, and a variable that is > special to automake. > In truth, I was planning to add a new test about substitutions and indirections in definition of "special" automake variables, as TESTS, bin_PROGRAMS and the like; that's why I felt justified in removing the line above. But I ended up not completing and submitting that patch because the patch queue was (and is) already too long. Now I have completed at least the testcase for EXTRA_DIST (see attachement); so, OK to keep this change if that testcase is added in a prior commit?
> > > --- /dev/null > > +++ b/tests/colneq3.test > > @@ -0,0 +1,46 @@ > > > +# Test that := definitions work as expected at make time. > > + > > +required=GNUmake > > +. ./defs || Exit 1 > > + > > +set -e > > + > > +cat >> configure.in << 'END' > > +AC_OUTPUT > > +END > > + > > +cat > Makefile.am << 'END' > > +BAR := $(FOO) > > +BAZ = $(FOO) > > +FOO := foo > > Uh, oh. Thin ice. This is OK, but we gotta remember that it won't > work reliably if some of these variables are actually automake-set > before they are overridden. automake generally orders all of its > variable settings before all of the user ones (so the user ones are > preferred). When I override, e.g., libdir here, however, it doesn't > get reordered to the user part. I wonder whether that is a bug in > automake. > I've added a new (xfailing) testcase to expose this bug/limitation. OK to apply it? > > +.PHONY: test > > +test: > > + test x'$(FOO)' = x'foo' > > + test x'$(BAZ)' = x'foo' > > + test x'$(BAR)' = x > > +END > > + > > +$ACLOCAL > > +$AUTOCONF > > +$AUTOMAKE -Wno-portability > > Trailing white space. > Oops. Fixed. Attached is what I squashed in the previous version of the patch, the resulting amended patch, and the testcase that should be added in a prior commit. Thanks, Stefano
From 579cc934085b818ebfd6c97d4dfa56d6f42ecdd8 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Thu, 25 Nov 2010 14:33:54 +0100 Subject: [PATCH] Improve and extend tests on := variable assignments. * tests/colneq.test: Avoid useless use of extra variable assignments in Makefile.am. Use command-line automake options instead of editing AUTOMAKE_OPTIONS in Makefile.am. Make grepping of the generated Makefile.in slightly stricter. Add a trailing `:' command. * tests/colneq.test: Avoid useless use of EXTRA_DIST special variable in Makefile.am. Do not create dummy files which are not needed anymore. Also run autoconf, ./configure and make. Add a trailing `:' command. * tests/colneq3.test: New test, similar to colneq.test, but running ./configure and make. * tests/colneq4.test: New test, similar to colneq3.test, but meddling with automake-set variable. It fails ATM. * tests/Makefile.am (TESTS, XFAIL_TEST): Update. --- ChangeLog | 18 ++++++++++++++++++ tests/Makefile.am | 3 +++ tests/Makefile.in | 3 +++ tests/colneq.test | 13 +++++++------ tests/colneq2.test | 19 ++++++++++++++----- tests/colneq3.test | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/colneq4.test | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 143 insertions(+), 11 deletions(-) create mode 100755 tests/colneq3.test create mode 100755 tests/colneq4.test diff --git a/ChangeLog b/ChangeLog index e8864f1..f0a7cfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2010-11-29 Stefano Lattarini <stefano.lattar...@gmail.com> + + Improve and extend tests on `:=' variable assignments. + * tests/colneq.test: Avoid useless use of extra variable + assignments in Makefile.am. Use command-line automake + options instead of editing AUTOMAKE_OPTIONS in Makefile.am. + Make grepping of the generated Makefile.in slightly stricter. + Add a trailing `:' command. + * tests/colneq.test: Avoid useless use of EXTRA_DIST special + variable in Makefile.am. Do not create dummy files which are + not needed anymore. Also run autoconf, ./configure and make. + Add a trailing `:' command. + * tests/colneq3.test: New test, similar to colneq.test, but + running ./configure and make. + * tests/colneq4.test: New test, similar to colneq3.test, but + meddling with automake-set variable. It fails ATM. + * tests/Makefile.am (TESTS, XFAIL_TEST): Update. + 2010-11-25 Stefano Lattarini <stefano.lattar...@gmail.com> Fix spurious failures in `silent*.test' for $CC != gcc diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e3..95381db 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,7 @@ XFAIL_TESTS = \ all.test \ auxdir2.test \ +colneq4.test \ cond17.test \ gcj6.test \ txinfo5.test @@ -138,6 +139,8 @@ clean.test \ clean2.test \ colneq.test \ colneq2.test \ +colneq3.test \ +colneq4.test \ colon.test \ colon2.test \ colon3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f43..21a6e7f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -275,6 +275,7 @@ top_srcdir = @top_srcdir@ XFAIL_TESTS = \ all.test \ auxdir2.test \ +colneq4.test \ cond17.test \ gcj6.test \ txinfo5.test @@ -405,6 +406,8 @@ clean.test \ clean2.test \ colneq.test \ colneq2.test \ +colneq3.test \ +colneq4.test \ colon.test \ colon2.test \ colon3.test \ diff --git a/tests/colneq.test b/tests/colneq.test index 59d2414..5e32e97 100755 --- a/tests/colneq.test +++ b/tests/colneq.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 1996, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1996, 2001, 2002, 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 @@ -21,14 +22,14 @@ set -e cat > Makefile.am << 'END' -ICONS := $(wildcard *.xbm) -data_DATA = $(ICONS) +FOOBAR := $(wildcard *.xbm) END $ACLOCAL AUTOMAKE_fails grep ':=.*not portable' stderr -echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am -$AUTOMAKE -grep 'ICONS :=' Makefile.in +$AUTOMAKE -Wno-portability +grep '^FOOBAR *:= *\$(wildcard \*\.xbm) *$' Makefile.in + +: diff --git a/tests/colneq2.test b/tests/colneq2.test index e454c46..0c05899 100755 --- a/tests/colneq2.test +++ b/tests/colneq2.test @@ -20,14 +20,23 @@ set -e +cat >> configure.in << 'END' +AC_OUTPUT +END + cat > Makefile.am << 'END' t = a b c -EXTRA_DIST = $(t:=.test) +FOO = $(t:=.test) +.PHONY: test +test: + test x'$(FOO)' = x'a.test b.test c.test' END -: > a.test -: > b.test -: > c.test - $ACLOCAL +$AUTOCONF $AUTOMAKE + +./configure +$MAKE test + +: diff --git a/tests/colneq3.test b/tests/colneq3.test new file mode 100755 index 0000000..0ff8bce --- /dev/null +++ b/tests/colneq3.test @@ -0,0 +1,46 @@ +#! /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 that := definitions work as expected at make time. + +required=GNUmake +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +BAR := $(FOO) +BAZ = $(FOO) +FOO := foo +.PHONY: test +test: + test x'$(FOO)' = x'foo' + test x'$(BAZ)' = x'foo' + test x'$(BAR)' = x +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -Wno-portability + +./configure +$MAKE test + +: diff --git a/tests/colneq4.test b/tests/colneq4.test new file mode 100755 index 0000000..177a7d7 --- /dev/null +++ b/tests/colneq4.test @@ -0,0 +1,52 @@ +#! /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 that := definitions work as expected at make time, even when +# whey involve user-overridden automake-set variables. +# +# Currently, this test doesn't work, because automake generally orders +# all of its variable settings (e.g. bindir and the like) before all +# of the user ones. Even when bindir is overridden, it doesn't get +# reordered to the user part. Might this be considered an automake bug? + +required=GNUmake +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +BAR := $(bindir) +BAZ = $(bindir) +bindir = foo +.PHONY: test +test: + test x'$(bindir)' = x'foo' + test x'$(BAZ)' = x'foo' + test x'$(BAR)' = x +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -Wno-portability + +./configure +$MAKE test + +: -- 1.7.1
diff --git a/ChangeLog b/ChangeLog index ace57fb..8713014 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,8 @@ 2010-11-25 Stefano Lattarini <stefano.lattar...@gmail.com> Improve and extend tests on `:=' variable assignments. - * tests/colneq.test: Avoid useless use of wildcards and extra - variable assignments in Makefile.am. Use command-line automake + * tests/colneq.test: Avoid useless use of extra variable + assignments in Makefile.am. Use command-line automake options instead of editing AUTOMAKE_OPTIONS in Makefile.am. Make grepping of the generated Makefile.in slightly stricter. Add a trailing `:' command. @@ -12,7 +12,9 @@ Add a trailing `:' command. * tests/colneq3.test: New test, similar to colneq.test, but running ./configure and make. - * tests/Makefile.am (TESTS): Update. + * tests/colneq4.test: New test, similar to colneq3.test, but + meddling with automake-set variable. It fails ATM. + * tests/Makefile.am (TESTS, XFAIL_TEST): Update. 2010-11-21 Stefano Lattarini <stefano.lattar...@gmail.com> diff --git a/tests/Makefile.am b/tests/Makefile.am index d36bf88..15048d9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,7 @@ XFAIL_TESTS = \ all.test \ auxdir2.test \ +colneq4.test \ cond17.test \ gcj6.test \ txinfo5.test @@ -139,6 +140,7 @@ clean2.test \ colneq.test \ colneq2.test \ colneq3.test \ +colneq4.test \ colon.test \ colon2.test \ colon3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index f545e6c..d06a30b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -275,6 +275,7 @@ top_srcdir = @top_srcdir@ XFAIL_TESTS = \ all.test \ auxdir2.test \ +colneq4.test \ cond17.test \ gcj6.test \ txinfo5.test @@ -406,6 +407,7 @@ clean2.test \ colneq.test \ colneq2.test \ colneq3.test \ +colneq4.test \ colon.test \ colon2.test \ colon3.test \ diff --git a/tests/colneq.test b/tests/colneq.test index 66dbb8b..5e32e97 100755 --- a/tests/colneq.test +++ b/tests/colneq.test @@ -22,7 +22,7 @@ set -e cat > Makefile.am << 'END' -FOOBAR := zardoz +FOOBAR := $(wildcard *.xbm) END $ACLOCAL @@ -30,6 +30,6 @@ AUTOMAKE_fails grep ':=.*not portable' stderr $AUTOMAKE -Wno-portability -grep '^FOOBAR *:= *zardoz *$' Makefile.in +grep '^FOOBAR *:= *\$(wildcard \*\.xbm) *$' Makefile.in : diff --git a/tests/colneq3.test b/tests/colneq3.test index 4c2afaa..0ff8bce 100755 --- a/tests/colneq3.test +++ b/tests/colneq3.test @@ -38,7 +38,7 @@ END $ACLOCAL $AUTOCONF -$AUTOMAKE -Wno-portability +$AUTOMAKE -Wno-portability ./configure $MAKE test diff --git a/tests/colneq4.test b/tests/colneq4.test new file mode 100755 index 0000000..177a7d7 --- /dev/null +++ b/tests/colneq4.test @@ -0,0 +1,52 @@ +#! /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 that := definitions work as expected at make time, even when +# whey involve user-overridden automake-set variables. +# +# Currently, this test doesn't work, because automake generally orders +# all of its variable settings (e.g. bindir and the like) before all +# of the user ones. Even when bindir is overridden, it doesn't get +# reordered to the user part. Might this be considered an automake bug? + +required=GNUmake +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +BAR := $(bindir) +BAZ = $(bindir) +bindir = foo +.PHONY: test +test: + test x'$(bindir)' = x'foo' + test x'$(BAZ)' = x'foo' + test x'$(BAR)' = x +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -Wno-portability + +./configure +$MAKE test + +:
posixsubst-extradist.test
Description: application/shellscript