2 # Id: run_test.sh,v 1.24 2014/07/15 19:21:10 tom Exp
7 # NEW is the file created by the testcase
8 # REF is the reference file against which to compare
10 # echo "...test_diffs $NEW vs $REF"
11 mv -f $NEW ${REF_DIR}/
15 echo "...not found $CMP"
19 -e "s%$YACC_escaped%YACC%" \
20 -e '/YYPATCH/s/[0-9][0-9]*/"yyyymmdd"/' \
21 -e '/#define YYPATCH/s/PATCH/CHECK/' \
22 -e 's,#line \([1-9][0-9]*\) "'$REF_DIR'/,#line \1 ",' \
23 -e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
24 -e 's,\(YACC:.* line [0-9][0-9]* of "\)'$TEST_DIR/',\1./,' \
31 elif ( cmp -s $REF $CMP )
44 echo "** testing flags $*"
48 $YACC $
* >$ROOT.output \
50 for type in .output .error
53 REF
=$REF_DIR/$root$type
62 PROG_DIR
=`echo "$PROG_DIR" | sed -e 's/ /\\\\ /g'`
63 TEST_DIR
=`echo "$TEST_DIR" | sed -e 's/ /\\\\ /g'`
70 YACC_escaped
=`echo "$PROG_DIR/yacc" | sed -e 's/\./\\\./g'`
74 ifBTYACC
=`fgrep -l 'define YYBTYACC' $PROG_DIR/config.h > /dev/null; test $? != 0; echo $?`
76 if test $ifBTYACC = 0; then
77 REF_DIR
=${TEST_DIR}/yacc
79 REF_DIR
=${TEST_DIR}/btyacc
82 rm -f ${REF_DIR}/test-
*
86 # Tests which do not need files
92 # Test attempts to read non-existent file
94 test_flags nostdin
- $MYFILE.y
95 test_flags no_opts
-- $MYFILE.y
97 # Test attempts to write to readonly file
102 test_flags no_b_opt
-b
103 test_flags no_b_opt1
-bBASE -o $MYFILE.c
$MYFILE.y
107 test_flags no_p_opt
-p
108 test_flags no_p_opt1
-pBASE -o $MYFILE.c
$MYFILE.y
113 test_flags no_graph
-g -o $MYFILE.c
$MYFILE.y
118 test_flags no_verbose
-v -o $MYFILE.c
$MYFILE.y
119 test_flags no_output
-o $MYFILE.output
$MYFILE.y
120 test_flags no_output1
-o$MYFILE.output
$MYFILE.y
121 test_flags no_output2
-o
126 test_flags no_defines
-d -o $MYFILE.c
$MYFILE.y
131 test_flags no_include
-i -o $MYFILE.c
$MYFILE.y
136 test_flags no_code_c
-r -o $MYFILE.c
$MYFILE.y
141 for input
in ${TEST_DIR}/*.y
145 echo "?? ignored $input"
148 root
=`basename $input .y`
155 TYPE
=".error .output .tab.c .tab.h"
157 ${TEST_DIR}/btyacc_
*)
158 if test $ifBTYACC = 0; then continue; fi
160 prefix
=`echo "$prefix" | sed -e 's/^btyacc_//'`
162 ${TEST_DIR}/grammar
*)
166 ${TEST_DIR}/code_debug
*)
175 prefix
=`echo "$prefix" | sed -e 's/^code_//'`
179 prefix
=`echo "$prefix" | sed -e 's/^pure_//'`
184 ${TEST_DIR}/inherit
*|\
185 ${TEST_DIR}/err_inherit
*)
186 if test $ifBTYACC = 0; then continue; fi
190 echo "** testing $input"
192 test -n "$prefix" && prefix
="-p $prefix"
200 error
=`basename $OOPT .c`.error
202 error
=${ROOT}${opt2}.error
205 $YACC $OPTS $opt2 -v -d $output $prefix -b $ROOT${opt2} $input 2>$error
208 REF
=${REF_DIR}/${root}${opt2}${type}
210 # handle renaming due to "-o" option
223 NEW
=`basename $OOPT .c`${type}
237 NEW
=${ROOT}${opt2}${type}