Improve and extend tests on `:=' variable assignments.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 25 Nov 2010 13:33:54 +0000 (14:33 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 30 Nov 2010 11:28:53 +0000 (12:28 +0100)
* 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
tests/Makefile.am
tests/Makefile.in
tests/colneq.test
tests/colneq2.test
tests/colneq3.test [new file with mode: 0755]

index e8864f1256205950e1439880ba9e5d1f9af5f28b..c0099e818e1924051bdedbbe00e745a90395e261 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-30  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        Fix spurious failures in `silent*.test' for $CC != gcc
index dab04e39336af6e94f6758b401366ee90e341e4b..fd9587f767da7b2be3d0ba071cf2706308682761 100644 (file)
@@ -138,6 +138,7 @@ clean.test \
 clean2.test \
 colneq.test \
 colneq2.test \
+colneq3.test \
 colon.test \
 colon2.test \
 colon3.test \
index de21f4334e83da8adf72837774285defe8cbafe1..e53a90353c6cbeb608478fdf6e9622ad3174152b 100644 (file)
@@ -405,6 +405,7 @@ clean.test \
 clean2.test \
 colneq.test \
 colneq2.test \
+colneq3.test \
 colon.test \
 colon2.test \
 colon3.test \
index 59d2414b64b24c61608a8ee5bdfb5435376657a8..ab789b3cf48f0c397c2681a88140ef406fb014b3 100755 (executable)
@@ -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
+
+:
index e454c46758ac99c1df0d24068d952015672dee9a..37be36017584b80b9fb32299e2baf685f3a049b1 100755 (executable)
 
 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 (executable)
index 0000000..0ff8bce
--- /dev/null
@@ -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
+
+: