2 # $Id: run_test.sh,v 1.22 2014/04/09 11:00:45 tom Exp $
5 # NEW is the file created by the testcase
6 # REF is the reference file against which to compare
8 # echo "...test_diffs $NEW vs $REF"
13 echo "...not found $CMP"
17 -e '/YYPATCH/s/[0-9][0-9]*/"yyyymmdd"/' \
18 -e '/#define YYPATCH/s/PATCH/CHECK/' \
19 -e 's,#line \([1-9][0-9]*\) "'$REF_DIR'/,#line \1 ",' \
20 -e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
27 elif ( cmp -s $REF $CMP )
39 echo "** testing flags $*"
43 $YACC $* >$ROOT.output \
45 for type in .output .error
48 REF=$REF_DIR/$root$type
57 PROG_DIR=`echo "$PROG_DIR" | sed -e 's/ /\\\\ /g'`
58 TEST_DIR=`echo "$TEST_DIR" | sed -e 's/ /\\\\ /g'`
68 ifBTYACC=`fgrep -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
70 if test $ifBTYACC = 0; then
71 REF_DIR=${TEST_DIR}/yacc
73 REF_DIR=${TEST_DIR}/btyacc
76 rm -f ${REF_DIR}/test-*
80 # Tests which do not need files
86 # Test attempts to read non-existent file
88 test_flags nostdin - $MYFILE.y
89 test_flags no_opts -- $MYFILE.y
91 # Test attempts to write to readonly file
96 test_flags no_b_opt -b
97 test_flags no_b_opt1 -bBASE -o $MYFILE.c $MYFILE.y
101 test_flags no_p_opt -p
102 test_flags no_p_opt1 -pBASE -o $MYFILE.c $MYFILE.y
107 test_flags no_graph -g -o $MYFILE.c $MYFILE.y
112 test_flags no_verbose -v -o $MYFILE.c $MYFILE.y
113 test_flags no_output -o $MYFILE.output $MYFILE.y
114 test_flags no_output1 -o$MYFILE.output $MYFILE.y
115 test_flags no_output2 -o
120 test_flags no_defines -d -o $MYFILE.c $MYFILE.y
125 test_flags no_include -i -o $MYFILE.c $MYFILE.y
130 test_flags no_code_c -r -o $MYFILE.c $MYFILE.y
135 for input in ${TEST_DIR}/*.y
139 echo "?? ignored $input"
142 root=`basename $input .y`
149 TYPE=".error .output .tab.c .tab.h"
151 ${TEST_DIR}/btyacc_*)
152 if test $ifBTYACC = 0; then continue; fi
154 prefix=`echo "$prefix" | sed -e 's/^btyacc_//'`
156 ${TEST_DIR}/grammar*)
160 ${TEST_DIR}/code_debug*)
169 prefix=`echo "$prefix" | sed -e 's/^code_//'`
173 prefix=`echo "$prefix" | sed -e 's/^pure_//'`
178 ${TEST_DIR}/inherit*|\
179 ${TEST_DIR}/err_inherit*)
180 if test $ifBTYACC = 0; then continue; fi
184 echo "** testing $input"
186 test -n "$prefix" && prefix="-p $prefix"
194 error=`basename $OOPT .c`.error
196 error=${ROOT}${opt2}.error
199 $YACC $OPTS $opt2 -v -d $output $prefix -b $ROOT${opt2} $input 2>$error
202 REF=${REF_DIR}/${root}${opt2}${type}
204 # handle renaming due to "-o" option
217 NEW=`basename $OOPT .c`${type}
231 NEW=${ROOT}${opt2}${type}