tests: give few vala tests more significant names
[automake.git] / t / lex-nodist.sh
blob0bbb6cbe4a2239a50b4bef4e3990d60609b781f2
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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 # Checks for .c files derived from non-distributed .l sources.
18 # The test 'lex-pr204.sh' does similar check with AM_MAINTAINER_MODE
19 # enabled.
20 # The tests 'yacc-nodist.sh' and 'yacc-pr204.sh' does similar checks
21 # for yacc-generated .c and .h files.
23 required='cc lex'
24 . ./defs || exit 1
26 cat >> configure.ac << 'END'
27 AC_PROG_CC
28 dnl Sister test 'lex-pr204.sh' should use 'AC_PROG_LEX' instead.
29 AM_PROG_LEX
30 AC_OUTPUT
31 END
33 cat > Makefile.am << 'END'
34 .PHONY: test-build test-dist
35 test-build: all
36 ls -l
37 test -f lexer.l
38 test -f lexer.c
39 test-dist: distdir
40 ls -l $(distdir)
41 test ! -r $(distdir)/lexer.l
42 test ! -r $(distdir)/lexer.c
43 check-local: test-build test-dist
45 lexer.l:
46 rm -f $@ $@-t
47 :; { : \
48 && echo '%{' \
49 && echo '#define YY_NO_UNISTD_H 1' \
50 && echo '%}' \
51 && echo '%%' \
52 && echo '"GOOD" return EOF;' \
53 && echo '.'; \
54 } > $@-t
55 chmod a-w $@-t && mv -f $@-t $@
57 bin_PROGRAMS = prog
58 prog_SOURCES = main.c
59 nodist_prog_SOURCES = lexer.l
60 prog_LDADD = $(LEXLIB)
61 CLEANFILES = $(nodist_prog_SOURCES)
62 END
64 cat > main.c << 'END'
65 int main ()
67 return yylex ();
70 /* Avoid possible link errors. */
71 int yywrap (void)
73 return 1;
75 END
77 $ACLOCAL
78 $AUTOCONF
79 $AUTOMAKE -a
81 ./configure
82 $MAKE
83 $MAKE test-build
84 $MAKE test-dist
86 # But the distribution must work correctly, assuming the user has
87 # the proper tools to process yacc files.
88 $MAKE distcheck