fixup: list of yacc/lex tests was botched
[platform/upstream/automake.git] / tests / yacc-d-vpath.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 # This test checks that dependent files are updated before including
18 # in the distribution. `parse.c' depends on `parse.y'.  The latter is
19 # updated so that `parse.c' should be rebuilt.  Then we are running
20 # `make' and `make distdir' and check whether the version of `parse.c'
21 # to be distributed is up to date.
22
23 # Please keep this in sync with sister test `yaccvpath.test'.
24
25 required=yacc
26 . ./defs || Exit 1
27
28 set -e
29
30 cat >> configure.in << 'END'
31 AC_PROG_CC
32 AC_PROG_YACC
33 AC_OUTPUT
34 END
35
36 cat > Makefile.am << 'END'
37 bin_PROGRAMS = foo
38 foo_SOURCES = parse.y foo.c
39 AM_YFLAGS = -d
40 END
41
42 # Original parser, with `foobar'
43 cat > parse.y << 'END'
44 %{
45 int yylex () { return 0; }
46 void yyerror (char *s) {}
47 %}
48 %token FOOBAR
49 %%
50 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
51 END
52
53 cat > foo.c << 'END'
54 #include "parse.h"
55 int main () { return 0; }
56 END
57
58 $ACLOCAL
59 $AUTOCONF
60 $AUTOMAKE -a
61
62 $YACC -d parse.y
63 mv y.tab.c parse.c
64 mv y.tab.h parse.h
65 # Sanity checks.
66 grep foobar parse.c
67 grep FOOBAR parse.h
68
69 mkdir sub
70 cd sub
71 ../configure
72
73 $sleep
74
75 # New parser, with `fubar'
76 cat > ../parse.y << 'END'
77 %{
78 int yylex () { return 0; }
79 void yyerror (char *s) {}
80 %}
81 %token FUBAR
82 %%
83 fubar : 'f' 'u' 'b' 'a' 'r' {};
84 END
85
86 $MAKE
87 $MAKE distdir
88 $FGREP fubar $distdir/parse.c
89 $FGREP FUBAR $distdir/parse.h
90
91 # Now check to make sure that `make dist' will rebuild the parser.
92
93 $sleep
94
95 # New parser, with `maude'
96 cat > ../parse.y << 'END'
97 %{
98 int yylex () { return 0; }
99 void yyerror (char *s) {}
100 %}
101 %token MAUDE
102 %%
103 maude : 'm' 'a' 'u' 'd' 'e' {};
104 END
105
106 $MAKE distdir
107 $FGREP maude $distdir/parse.c
108 $FGREP MAUDE $distdir/parse.h
109
110 :