tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / byacc / dist / test / run_make.sh
blob22669be6ba247ebfe56339e1bf1b64a452266ebc
1 #!/bin/sh
2 # Id: run_make.sh,v 1.9 2012/01/15 22:35:01 tom Exp
3 # vi:ts=4 sw=4:
5 # do a test-compile on each of the ".c" files in the test-directory
7 BISON=`bison --version 2>/dev/null | head -n 1 | sed -e 's/^[^0-9.]*//' -e 's/[^0-9.]*$//'`
9 if test $# = 1
10 then
11 PROG_DIR=`pwd`
12 TEST_DIR=$1
13 else
14 PROG_DIR=..
15 TEST_DIR=.
18 MY_MAKE="make -f $PROG_DIR/makefile srcdir=$PROG_DIR VPATH=$TEST_DIR"
20 echo '** '`date`
21 for input in ${TEST_DIR}/*.c
23 test -f "$input" || continue
25 obj=`basename "$input" .c`.o
27 $MY_MAKE $obj C_FILES=$input
28 test -f $obj && rm $obj
30 DEFS=
31 case $input in #(vi
32 ${TEST_DIR}/pure_*)
33 # DEFS="-DYYLEX_PARAM=flag -DYYLEX_PARAM_TYPE=int"
35 esac
37 if test "x$DEFS" != "x"
38 then
39 $MY_MAKE $obj C_FILES=$input DEFINES="$DEFS"
40 test -f $obj && rm -f $obj
42 done
44 if test -n "$BISON"
45 then
46 echo "** compare with bison $BISON"
47 for input in ${TEST_DIR}/*.y
49 test -f "$input" || continue
51 # Bison does not support pure-parser from command-line.
52 # Also, its support for %expect is generally broken.
53 # Work around these issues using a temporary file.
55 echo "... testing $input"
56 rm -f run_make.[coy]
58 case $input in
59 pure_*)
60 if test -z `fgrep -l '%pure-parser' $input`
61 then
62 echo "%pure-parser" >>run_make.y
65 esac
67 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
69 bison -y run_make.y
70 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
72 rm -f y.tab.c
74 input=run_make.c
75 object=run_make.o
76 if test -f $input
77 then
78 $MY_MAKE $object DEFINES='-DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=1 -DYYSTACK_USE_ALLOCA=0 -DYYMAXDEPTH=0'
79 else
80 echo "?? $input not found"
82 rm -f run_make.[coy]
83 done
86 YACC=
87 for name in /usr/ccs/bin/yacc
89 if test -f $name
90 then
91 YACC=$name
93 done
95 if test -n "$YACC"
96 then
97 echo "** compare with $YACC"
98 for input in ${TEST_DIR}/*.y
100 test -f "$input" || continue
102 echo "... testing $input"
103 rm -f run_make.[coy]
105 case $input in
106 pure_*)
107 echo "... skipping $input"
108 continue;
111 if fgrep '%pure-parser' $input >/dev/null ||
112 fgrep '%parse-param' $input >/dev/null ||
113 fgrep '%lex-param' $input >/dev/null ||
114 fgrep 'YYLEX_PARAM' $input >/dev/null
115 then
116 echo "... skipping $input"
117 continue;
120 esac
122 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
124 $YACC run_make.y
125 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
127 rm -f y.tab.c
129 input=run_make.c
130 object=run_make.o
131 if test -f $input
132 then
133 $MY_MAKE $object
134 else
135 echo "?? $input not found"
137 rm -f run_make.[coy]
138 done