2 # $Id: run_make.sh,v 1.18 2019/11/25 23:23:26 tom Exp $
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.]*$//'`
19 ifBTYACC=`fgrep -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
21 if test $ifBTYACC = 0; then
22 REF_DIR=${TEST_DIR}/yacc
24 REF_DIR=${TEST_DIR}/btyacc
27 MY_MAKE="make -f $PROG_DIR/makefile srcdir=$PROG_DIR"
30 C_FILE=`basename "$1"`
31 O_FILE=`basename "$C_FILE" .c`.o
34 make -f $PROG_DIR/makefile srcdir=$PROG_DIR $O_FILE $*
35 test -f $O_FILE && rm $O_FILE
40 echo "** program is in $PROG_DIR"
41 echo "** test-files in $REF_DIR"
43 for input in ${REF_DIR}/*.c
47 ${REF_DIR}/test-err_*)
52 test -f "$input" || continue
59 # DEFS="-DYYLEX_PARAM=flag -DYYLEX_PARAM_TYPE=int"
63 if test "x$DEFS" != "x"
65 run_make "$input" DEFINES="$DEFS"
71 echo "** compare with bison $BISON"
72 for input in ${TEST_DIR}/*.y
74 test -f "$input" || continue
77 ${TEST_DIR}/test-err_*)
80 ${TEST_DIR}/ok_syntax*|\
81 ${TEST_DIR}/varsyntax*)
82 # Bison does not support all byacc legacy syntax
86 # Bison does not support the btyacc []-action & inherited attribute extensions.
91 # Bison does not support pure-parser from command-line.
92 # Also, its support for %expect is generally broken.
93 # Work around these issues using a temporary file.
95 echo "... testing $input"
100 if test -z `fgrep -i -l '%pure-parser' $input`
102 echo "%pure-parser" >>run_make.y
107 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
111 bison -Wno-other -Wno-conflicts-sr -Wconflicts-rr -y -Wno-yacc run_make.y
119 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
127 $MY_MAKE $object DEFINES='-DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=1 -DYYSTACK_USE_ALLOCA=0 -DYYMAXDEPTH=0'
129 echo "?? $input not found"
137 for name in /usr/ccs/bin/yacc
147 echo "** compare with $YACC"
148 for input in ${TEST_DIR}/*.y
150 test -f "$input" || continue
152 echo "... testing $input"
157 echo "... skipping $input"
161 if fgrep -i '%pure-parser' $input >/dev/null ||
162 fgrep -i '%parse-param' $input >/dev/null ||
163 fgrep -i '%lex-param' $input >/dev/null ||
164 fgrep -i '%token-table' $input >/dev/null ||
165 fgrep 'YYLEX_PARAM' $input >/dev/null
167 echo "... skipping $input"
173 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
178 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
188 echo "?? $input not found"