003 File Manager
Current Path:
/usr/src/contrib/byacc/test
usr
/
src
/
contrib
/
byacc
/
test
/
📁
..
📄
README
(142 B)
📁
btyacc
📄
btyacc_calc1.y
(4.42 KB)
📄
btyacc_demo.y
(6.55 KB)
📄
btyacc_destroy1.y
(1.56 KB)
📄
btyacc_destroy2.y
(1.56 KB)
📄
btyacc_destroy3.y
(1.56 KB)
📄
calc.y
(1.84 KB)
📄
calc1.y
(4.22 KB)
📄
calc2.y
(2.31 KB)
📄
calc3.y
(2.37 KB)
📄
calc_code_all.y
(2.07 KB)
📄
calc_code_default.y
(1.92 KB)
📄
calc_code_imports.y
(1.92 KB)
📄
calc_code_provides.y
(1.92 KB)
📄
calc_code_requires.y
(1.92 KB)
📄
calc_code_top.y
(1.91 KB)
📄
code_calc.y
(1.92 KB)
📄
code_debug.y
(341 B)
📄
code_error.y
(341 B)
📄
empty.y
(290 B)
📄
err_inherit1.y
(1.09 KB)
📄
err_inherit2.y
(1.39 KB)
📄
err_inherit3.y
(1.38 KB)
📄
err_inherit4.y
(1.41 KB)
📄
err_inherit5.y
(1.37 KB)
📄
err_syntax1.y
(272 B)
📄
err_syntax10.y
(323 B)
📄
err_syntax11.y
(292 B)
📄
err_syntax12.y
(303 B)
📄
err_syntax13.y
(299 B)
📄
err_syntax14.y
(296 B)
📄
err_syntax15.y
(286 B)
📄
err_syntax16.y
(330 B)
📄
err_syntax17.y
(273 B)
📄
err_syntax18.y
(319 B)
📄
err_syntax19.y
(324 B)
📄
err_syntax2.y
(272 B)
📄
err_syntax20.y
(347 B)
📄
err_syntax21.y
(355 B)
📄
err_syntax22.y
(410 B)
📄
err_syntax23.y
(418 B)
📄
err_syntax24.y
(415 B)
📄
err_syntax25.y
(454 B)
📄
err_syntax26.y
(71 B)
📄
err_syntax27.y
(2.36 KB)
📄
err_syntax3.y
(296 B)
📄
err_syntax4.y
(268 B)
📄
err_syntax5.y
(301 B)
📄
err_syntax6.y
(296 B)
📄
err_syntax7.y
(292 B)
📄
err_syntax7a.y
(293 B)
📄
err_syntax7b.y
(291 B)
📄
err_syntax8.y
(287 B)
📄
err_syntax8a.y
(291 B)
📄
err_syntax9.y
(307 B)
📄
error.y
(269 B)
📄
expr.oxout.y
(29.75 KB)
📄
grammar.y
(26.98 KB)
📄
inherit0.y
(797 B)
📄
inherit1.y
(1.38 KB)
📄
inherit2.y
(1.37 KB)
📄
ok_syntax1.y
(2.92 KB)
📄
pure_calc.y
(2.03 KB)
📄
pure_error.y
(496 B)
📄
quote_calc.y
(1.97 KB)
📄
quote_calc2.y
(1.97 KB)
📄
quote_calc3.y
(2.03 KB)
📄
quote_calc4.y
(2.08 KB)
📄
run_lint.sh
(509 B)
📄
run_make.sh
(3.58 KB)
📄
run_test.sh
(5.9 KB)
📄
varsyntax_calc1.y
(4.48 KB)
📁
yacc
Editing: run_test.sh
#!/bin/sh # $Id: run_test.sh,v 1.31 2019/11/03 23:44:07 tom Exp $ # vi:ts=4 sw=4: errors=0 # NEW is the file created by the testcase # REF is the reference file against which to compare test_diffs() { # echo "...test_diffs $NEW vs $REF" mv -f $NEW ${REF_DIR}/ CMP=${REF_DIR}/${NEW} if test ! -f $CMP then echo "...not found $CMP" errors=1 else sed -e s,$NEW,$REF, \ -e "s%$YACC_escaped%YACC%" \ -e "s%^yacc\>%YACC%" \ -e "s%YACC:.*option.*$%YACC: error message%" \ -e "s%^Usage: yacc\>%Usage: YACC%" \ -e '/YYPATCH/s/[0-9][0-9]*/"yyyymmdd"/' \ -e '/#define YYPATCH/s/PATCH/CHECK/' \ -e 's,#line \([1-9][0-9]*\) "'$REF_DIR'/,#line \1 ",' \ -e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \ -e 's,\(YACC:.* line [0-9][0-9]* of "\)'$TEST_DIR/',\1./,' \ < $CMP >$tmpfile \ && mv $tmpfile $CMP if test ! -f $REF then mv $CMP $REF echo "...saved $REF" elif ( cmp -s $REF $CMP ) then echo "...ok $REF" rm -f $CMP else echo "...diff $REF" diff -u $REF $CMP errors=1 fi fi } test_flags() { echo "** testing flags $*" root=$1 ROOT=test-$root shift 1 $YACC "$@" >$ROOT.output 2>$ROOT.error for type in .output .error do NEW=$ROOT$type REF=$REF_DIR/$root$type test_diffs done } test_stdin() { echo "** testing stdin $*" root=$1 ROOT=test-$root shift 1 opts="$1" shift 1 code=`echo "$1"|sed -e 's/y$/c/' -e "s,${TEST_DIR}/,,"` if test "x$opts" = "x-" then $YACC -o $ROOT.$code $opts <$1 >$ROOT.output 2>$ROOT.error else $YACC -o $ROOT.$code $opts $1 >$ROOT.output 2>$ROOT.error fi for type in .output .error .$code do NEW=$ROOT$type REF=$REF_DIR/$root$type test_diffs done } test_defines() { echo "** testing defines $*" root=$1 ROOT=test-$root shift 1 opts= while test $# != 1 do opts="$opts $1" shift 1 done head=`echo "$1"|sed -e 's/y$/h/' -e "s,${TEST_DIR}/,,"` code=`echo "$1"|sed -e 's/y$/c/' -e "s,${TEST_DIR}/,,"` $YACC $opts -H $ROOT.$head $1 >$ROOT.output 2>$ROOT.error for name in prefix.tab.c y.tab.c do if test -f $name then mv $name $ROOT.$code break fi done for name in .output .error .$head .$code do NEW=$ROOT$name REF=$REF_DIR/$root$name test_diffs done } if test $# = 1 then PROG_DIR=`pwd` TEST_DIR=$1 PROG_DIR=`echo "$PROG_DIR" | sed -e 's/ /\\\\ /g'` TEST_DIR=`echo "$TEST_DIR" | sed -e 's/ /\\\\ /g'` else PROG_DIR=.. TEST_DIR=. fi YACC=$PROG_DIR/yacc YACC_escaped=`echo "$PROG_DIR/yacc" | sed -e 's/\./\\\./g'` tmpfile=temp$$ ifBTYACC=`fgrep -l 'define YYBTYACC' $PROG_DIR/config.h > /dev/null; test $? != 0; echo $?` if test $ifBTYACC = 0; then REF_DIR=${TEST_DIR}/yacc else REF_DIR=${TEST_DIR}/btyacc fi rm -f ${REF_DIR}/test-* echo '** '`date` # Tests which do not need files MYFILE=nosuchfile test_flags help -z test_flags big_b -B test_flags big_l -L # Test attempts to read non-existent file rm -f $MYFILE.* test_flags nostdin - $MYFILE.y test_flags no_opts -- $MYFILE.y # Test attempts to write to readonly file touch $MYFILE.y touch $MYFILE.c chmod 444 $MYFILE.* test_flags no_b_opt -b test_flags no_b_opt1 -bBASE -o $MYFILE.c $MYFILE.y touch $MYFILE.c chmod 444 $MYFILE.* test_flags no_p_opt -p test_flags no_p_opt1 -pBASE -o $MYFILE.c $MYFILE.y rm -f BASE$MYFILE.c touch $MYFILE.dot chmod 444 $MYFILE.* test_flags no_graph -g -o $MYFILE.c $MYFILE.y rm -f $MYFILE.dot touch $MYFILE.output chmod 444 $MYFILE.* test_flags no_verbose -v -o $MYFILE.c $MYFILE.y test_flags no_output -o $MYFILE.output $MYFILE.y test_flags no_output1 -o$MYFILE.output $MYFILE.y test_flags no_output2 -o rm -f $MYFILE.output touch $MYFILE.h chmod 444 $MYFILE.* test_flags no_defines -d -o $MYFILE.c $MYFILE.y rm -f $MYFILE.h touch $MYFILE.i chmod 444 $MYFILE.* test_flags no_include -i -o $MYFILE.c $MYFILE.y rm -f $MYFILE.i touch $MYFILE.code.c chmod 444 $MYFILE.* test_flags no_code_c -r -o $MYFILE.c $MYFILE.y rm -f $MYFILE.code.c rm -f $MYFILE.* # Test special cases test_stdin stdin1 - ${TEST_DIR}/calc.y test_stdin stdin2 -- ${TEST_DIR}/calc.y test_defines defines1 ${TEST_DIR}/calc.y test_defines defines2 -d ${TEST_DIR}/calc.y test_defines defines3 -b prefix ${TEST_DIR}/calc.y for input in ${TEST_DIR}/*.y do case $input in test-*) echo "?? ignored $input" ;; *) root=`basename $input .y` ROOT="test-$root" prefix=${root}_ OPTS= OPT2= OOPT= TYPE=".error .output .tab.c .tab.h" case $input in ${TEST_DIR}/btyacc_*) if test $ifBTYACC = 0; then continue; fi OPTS="$OPTS -B" prefix=`echo "$prefix" | sed -e 's/^btyacc_//'` ;; ${TEST_DIR}/grammar*) OPTS="$OPTS -g" TYPE="$TYPE .dot" ;; ${TEST_DIR}/code_debug*) OPTS="$OPTS -t -i" OOPT=rename_debug.c TYPE="$TYPE .i" prefix= ;; ${TEST_DIR}/code_*) OPTS="$OPTS -r" TYPE="$TYPE .code.c" prefix=`echo "$prefix" | sed -e 's/^code_//'` ;; ${TEST_DIR}/pure_*) OPTS="$OPTS -P" prefix=`echo "$prefix" | sed -e 's/^pure_//'` ;; ${TEST_DIR}/quote_*) OPT2="-s" ;; ${TEST_DIR}/inherit*|\ ${TEST_DIR}/err_inherit*) if test $ifBTYACC = 0; then continue; fi ;; esac echo "** testing $input" test -n "$prefix" && prefix="-p $prefix" for opt2 in "" $OPT2 do output=$OOPT if test -n "$output" then output="-o $output" error=`basename $OOPT .c`.error else error=${ROOT}${opt2}.error fi $YACC $OPTS $opt2 -v -d $output $prefix -b $ROOT${opt2} $input 2>$error for type in $TYPE do REF=${REF_DIR}/${root}${opt2}${type} # handle renaming due to "-o" option if test -n "$OOPT" then case $type in *.tab.c) type=.c ;; *.tab.h) type=.h ;; *) ;; esac NEW=`basename $OOPT .c`${type} case $NEW in test-*) ;; *) if test -f "$NEW" then REF=${REF_DIR}/$NEW mv $NEW test-$NEW NEW=test-$NEW fi ;; esac else NEW=${ROOT}${opt2}${type} fi test_diffs done done ;; esac done exit $errors
Upload File
Create Folder