Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / test-extensions-cond.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 # Expose bug in conditional definition of TEST_EXTENSIONS.
18
19 parallel_tests=yes
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AM_CONDITIONAL([COND], [:])
26 AM_CONDITIONAL([COND2], [:])
27 END
28
29 $ACLOCAL
30
31 cat > 1.am << 'END'
32 TESTS =
33 if COND
34 ## lineno 4
35 TEST_EXTENSIONS = .foo
36 endif
37 END
38
39 cat > 2.am << 'END'
40 TESTS =
41 ## lineno 3
42 TEST_EXTENSIONS = .foo
43 if COND
44 # Do nothing.
45 else
46 TEST_EXTENSIONS += .bar
47 endif
48 END
49
50 cat > 3.am << 'END'
51 TESTS =
52 if COND
53 if !COND2
54 TESTS = x
55 else
56 ## lineno 7
57 TEST_EXTENSIONS = .foo
58 endif
59 endif
60 END
61
62 : > test-driver
63
64 for i in 1 2 3; do
65   AUTOMAKE_fails $i
66   lineno=`sed -n 's/^## lineno //p' $i.am` \
67     && test 0 -lt "$lineno" \
68     || Exit 99
69   grep "^$i\\.am:$lineno:.*TEST_EXTENSIONS.*conditional content" stderr
70 done
71
72 :