2 # $Id: run_make.sh,v 1.15 2016/06/01 22:56:37 Tom.Shields 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 -l '%pure-parser' $input`
102 echo "%pure-parser" >>run_make.y
107 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
109 bison -Wno-other -Wno-conflicts-sr -Wconflicts-rr -y run_make.y
112 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
120 $MY_MAKE $object DEFINES='-DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=1 -DYYSTACK_USE_ALLOCA=0 -DYYMAXDEPTH=0'
122 echo "?? $input not found"
130 for name in /usr/ccs/bin/yacc
140 echo "** compare with $YACC"
141 for input in ${TEST_DIR}/*.y
143 test -f "$input" || continue
145 echo "... testing $input"
150 echo "... skipping $input"
154 if fgrep '%pure-parser' $input >/dev/null ||
155 fgrep '%parse-param' $input >/dev/null ||
156 fgrep '%lex-param' $input >/dev/null ||
157 fgrep 'YYLEX_PARAM' $input >/dev/null
159 echo "... skipping $input"
165 sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
170 sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
180 echo "?? $input not found"