From 02a8fc7c5064868abc9fad0a70b9785c6ebaf4bd Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 25 Nov 2010 14:33:54 +0100 Subject: [PATCH] Improve and extend tests on `:=' variable assignments. * tests/colneq.test: Avoid redundant use of 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/colneq2.test: Do not create unneeded dummy files. Run also autoconf, ./configure and make. Add trailing `:' command. * tests/colneq3.test: New test, similar to colneq.test, but running also autoconf, ./configure and make. * tests/Makefile.am (TESTS): Update. --- ChangeLog | 14 ++++++++++++++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/colneq.test | 11 ++++++----- tests/colneq2.test | 17 +++++++++++++---- tests/colneq3.test | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 9 deletions(-) create mode 100755 tests/colneq3.test diff --git a/ChangeLog b/ChangeLog index e8864f125..c0099e818 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-11-30 Stefano Lattarini + + Improve and extend tests on `:=' variable assignments. + * tests/colneq.test: Avoid redundant use of 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/colneq2.test: Do not create unneeded dummy files. Run + also autoconf, ./configure and make. Add trailing `:' command. + * tests/colneq3.test: New test, similar to colneq.test, but + running also autoconf, ./configure and make. + * tests/Makefile.am (TESTS): Update. + 2010-11-25 Stefano Lattarini Fix spurious failures in `silent*.test' for $CC != gcc diff --git a/tests/Makefile.am b/tests/Makefile.am index dab04e393..fd9587f76 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -138,6 +138,7 @@ clean.test \ clean2.test \ colneq.test \ colneq2.test \ +colneq3.test \ colon.test \ colon2.test \ colon3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index de21f4334..e53a90353 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -405,6 +405,7 @@ clean.test \ clean2.test \ colneq.test \ colneq2.test \ +colneq3.test \ colon.test \ colon2.test \ colon3.test \ diff --git a/tests/colneq.test b/tests/colneq.test index 59d2414b6..ab789b3cf 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 @@ -22,13 +23,13 @@ set -e cat > Makefile.am << 'END' ICONS := $(wildcard *.xbm) -data_DATA = $(ICONS) END $ACLOCAL AUTOMAKE_fails grep ':=.*not portable' stderr -echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am -$AUTOMAKE -grep 'ICONS :=' Makefile.in +$AUTOMAKE -Wno-portability +grep '^ICONS *:= *\$(wildcard \*\.xbm) *$' Makefile.in + +: diff --git a/tests/colneq2.test b/tests/colneq2.test index e454c4675..37be36017 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) +.PHONY: test +test: + test x'$(EXTRA_DIST)' = 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 000000000..0ff8bcebb --- /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 . + +# 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 + +: -- 2.47.2