tests: make 'lzip.test' executable
[automake.git] / tests / yaccvpath.test
blob6db5fd7c176ddd9cee5f3120d39527dbaefbbc5b
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003 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 # This test checks that dependent files are updated before including
18 # in the distribution. `parse.c' depends on `parce.y'. The later is
19 # updated so that `parse.c' should be rebuild. 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.
23 required='gcc bison'
24 . ./defs || Exit 1
26 cat > configure.in << 'END'
27 AC_INIT
28 AC_CONFIG_AUX_DIR([.])
29 AM_INIT_AUTOMAKE(foo, 0.1)
30 PACKAGE=foo
31 VERSION=0.1
32 AC_PROG_CC
33 AC_PROG_YACC
34 AC_OUTPUT(Makefile)
35 END
37 cat > Makefile.am << 'END'
38 bin_PROGRAMS = foo
39 foo_SOURCES = parse.y foo.c
40 END
42 # Original parser, with `foobar'
43 cat > parse.y << 'END'
45 int yylex () {return 0;}
46 void yyerror (char *s) {}
49 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
50 END
52 cat > foo.c << 'END'
53 int main () { return 0; }
54 END
56 set -e
58 $ACLOCAL
59 $AUTOCONF
60 $AUTOMAKE -a
62 $YACC parse.y
63 mv y.tab.c parse.c
65 mkdir sub
66 cd sub
67 ../configure
69 # A delay is needed to make sure that the new parse.y is indeed newer
70 # than parse.c, i.e. the they don't have the same timestamp.
71 $sleep
73 # New parser, with `fubar'
74 cat > ../parse.y << 'END'
76 int yylex () {return 0;}
77 void yyerror (char *s) {}
80 fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
81 END
83 $MAKE
84 $MAKE distdir
85 grep fubar foo-0.1/parse.c
88 # Now check to make sure that `make dist' will rebuild the parser.
91 # A delay is needed to make sure that the new parse.y is indeed newer
92 # than parse.c, i.e. the they don't have the same timestamp.
93 $sleep
95 # New parser, with `maude'
96 cat > ../parse.y << 'END'
98 int yylex () {return 0;}
99 void yyerror (char *s) {}
102 maude : 'm' 'a' 'u' 'd' 'e' {};
105 $MAKE distdir
106 grep maude foo-0.1/parse.c