tests: make 'lzip.test' executable
[automake.git] / tests / vars3.test
blob6b738ab98fe92c9966d313c76e34d81e758c3e51
1 #! /bin/sh
2 # Copyright (C) 2002, 2010 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Check that Automake warns about variables containing spaces
18 # and other non-POSIX characters.
20 . ./defs || Exit 1
22 set -e
24 cat >Makefile.am <<'EOF'
25 L01 = $(shell echo *)
26 L02 = $$(not an error)
27 L03 = $$(this is)$${ok too}
28 L04 = $(nextvariableisbad)$(addsuffix .a, $(A))
29 L05 = "$(bad boy)"
30 L06 = $(this:is= ok)
31 L07 = ${three errors}${on this} $(long line)
32 L08$(o u c h): $(wildcard *.c)
33 ${another error}
34 echo $${ok-this is}
35 L11: $(thisis) $(ok)
36 ${here}
37 EOF
39 $ACLOCAL
40 # Make sure this warning is print in the `portability' category.
41 $AUTOMAKE --warnings=no-error,none,portability 2>stderr \
42 || { cat stderr >&2; Exit 1; }
43 cat stderr >&2
45 # Lines number are printed in error message.
46 # Use them to make sure errors are diagnosed against the right lines.
48 # No error expected for these lines.
49 grep 1: stderr
50 grep 2: stderr && Exit 1
51 grep 3: stderr && Exit 1
52 grep 4: stderr
53 grep 5: stderr
54 grep 6: stderr && Exit 1
55 grep 7: stderr
56 grep 8: stderr
57 grep 9: stderr
58 grep 10: stderr && Exit 1
59 grep 11: stderr && Exit 1
60 grep 12: stderr && Exit 1
62 # Now check some individual values.
63 grep 'shell echo' stderr
64 grep 'nextvariableisbad' stderr && Exit 1
65 grep 'addsuffix' stderr
66 grep 'bad boy' stderr
67 grep 'ok' stderr && Exit 1
68 grep 'three errors' stderr
69 grep 'on this' stderr
70 grep 'long line' stderr
71 grep 'o u c h' stderr
72 grep 'wildcard' stderr
73 grep 'another error' stderr
74 grep 'thisis' stderr && Exit 1
75 grep 'here' stderr && Exit 1
77 # None of these errors be diagnosed with -Wno-portability
78 $AUTOMAKE -Wno-portability
80 # Likewise if we add this in the Makefile.am
81 # (although this makes some difference internally: AUTOMAKE_OPTIONS is
82 # processed far later).
83 echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
84 $AUTOMAKE