summaryrefslogtreecommitdiff
path: root/tests/dollarvar.test
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-03-07 15:59:24 +0100
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-03-07 16:03:02 +0100
commita51f03728410166e827262b59f85f31f0419e69d (patch)
tree89c061e08d076dd0b645cf70ef3bb386140b1a66 /tests/dollarvar.test
parente0bd4af16da88e4c2c61bde42675660eff7dff51 (diff)
downloadautomake-a51f03728410166e827262b59f85f31f0419e69d.tar.gz
Documentation and tests for the `silent' option.
* NEWS: Update. * doc/automake.texi (Invoking Automake): `silent' turns off some portability warnings. (Libtool Flags): `silent' silences libtool. (Options): Document the `silent' flag. * tests/dollarvar.test, tests/silent.test, tests/silent2.test, tests/silent3.test, tests/silent4.test, tests/silent5.test: New tests. * tests/Makefile.am: Update. * Makefile.am (maintainer-check): Ignore `DESTDIR' and `V' when checking for make variables that should not be overridden from the command line. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'tests/dollarvar.test')
-rwxr-xr-xtests/dollarvar.test63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/dollarvar.test b/tests/dollarvar.test
new file mode 100755
index 000000000..3c43a61b7
--- /dev/null
+++ b/tests/dollarvar.test
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright (C) 2009 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 3, 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 to make sure that -Wportability complains about recursive
+# variable expansions and variables containing `$', `$(...)', or
+# `${...}' in the name. We support recursive variable expansions using
+# the latter two constructs for the `silent' option, and they are
+# rather widely supported in practice. OTOH variable definitions
+# containing a `$' on the left hand side of an assignment are not
+# portable in practice, even though POSIX allows them. :-/
+
+. ./defs
+
+set -e
+
+cat >Makefile.am <<'EOF'
+x = 1
+foo$x = 1
+bar$(x) = 1
+baz${x} = 1
+bla = $(foo$x)
+bli = $(foo$(x))
+blo = $(foo${x})
+EOF
+
+$ACLOCAL
+AUTOMAKE_fails -Wportability
+grep 'Makefile.am:2' stderr
+grep 'Makefile.am:3' stderr
+grep 'Makefile.am:4' stderr
+grep 'Makefile.am:5' stderr
+grep 'Makefile.am:6' stderr
+grep 'Makefile.am:7' stderr
+
+# On the other hand, if we allow `silent' mode, then we need to allow
+# recursive variable expansion, too.
+
+# This should work with AUTOMAKE_OPTIONS.
+echo 'AUTOMAKE_OPTIONS = silent' >> Makefile.am
+
+AUTOMAKE_fails -Wportability
+grep 'Makefile.am:2' stderr
+grep 'Makefile.am:3' stderr
+grep 'Makefile.am:4' stderr
+grep 'Makefile.am:5' stderr
+grep 'Makefile.am:6' stderr && Exit 1
+grep 'Makefile.am:7' stderr && Exit 1
+
+
+: