tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / dollarvar.sh
1 #!/bin/sh
2 # Copyright (C) 2009-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Test to make sure that -Wportability complains about recursive
18 # variable expansions and variables containing '$', '$(...)', or
19 # '${...}' in the name.  We support recursive variable expansions using
20 # the latter two constructs for the 'silent-rules' option, and they are
21 # rather widely supported in practice.  OTOH variable definitions
22 # containing a '$' on the left hand side of an assignment are not
23 # portable in practice, even though POSIX allows them.  :-/
24
25 . test-init.sh
26
27 cat >Makefile.am <<'EOF'
28 x = 1
29 foo$x = 1
30 bar$(x) = 1
31 baz${x} = 1
32 bla = $(foo$x)
33 bli = $(foo$(x))
34 blo = $(foo${x})
35 EOF
36
37 $ACLOCAL
38
39 AUTOMAKE_fails -Wportability
40 grep 'Makefile.am:2' stderr
41 grep 'Makefile.am:3' stderr
42 grep 'Makefile.am:4' stderr
43 grep 'Makefile.am:5' stderr
44 grep 'Makefile.am:6' stderr
45 grep 'Makefile.am:7' stderr
46
47 AUTOMAKE_fails -Wportability -Wno-portability-recursive
48 grep 'Makefile.am:2' stderr
49 grep 'Makefile.am:3' stderr
50 grep 'Makefile.am:4' stderr
51 grep 'Makefile.am:5' stderr
52 grep 'Makefile.am:6' stderr && exit 1
53 grep 'Makefile.am:7' stderr && exit 1
54
55
56 :