📄 testone
字号:
#!/bin/sh -# $Id: testone,v 1.5 2002/08/16 19:35:56 dda Exp $## Run just one Java regression test, the single argument# is the classname within this package.error(){ echo '' >&2 echo "Java regression error: $@" >&2 echo '' >&2 ecode=1}# compares the result against the good version,# reports differences, and removes the result file# if there are no differences.#compare_result(){ good="$1" latest="$2" if [ ! -e "$good" ]; then echo "Note: $good does not exist" return fi tmpout=/tmp/blddb$$.tmp diff "$good" "$latest" > $tmpout if [ -s $tmpout ]; then nbad=`grep '^[0-9]' $tmpout | wc -l` error "$good and $latest differ in $nbad places." else rm $latest fi rm -f $tmpout}ecode=0stdinflag=nJAVA=${JAVA:-java}JAVAC=${JAVAC:-javac}# classdir is relative to TESTDIR subdirectoryclassdir=./classes# CLASSPATH is used by javac and java.# We use CLASSPATH rather than the -classpath command line option# because the latter behaves differently from JDK1.1 and JDK1.2export CLASSPATH="$classdir:$CLASSPATH"# determine the prefix of the install treeprefix=""while :do case "$1" in --prefix=* ) prefix="`echo $1 | sed -e 's/--prefix=//'`"; shift export LD_LIBRARY_PATH="$prefix/lib:$LD_LIBRARY_PATH" export CLASSPATH="$prefix/lib/db.jar:$CLASSPATH" ;; --stdin ) stdinflag=y; shift ;; * ) break ;; esacdoneif [ "$#" = 0 ]; then echo 'Usage: testone [ --prefix=<dir> | --stdin ] TestName' exit 1finame="$1"# class must be publicif ! grep "public.*class.*$name" $name.java > /dev/null; then error "public class $name is not declared in file $name.java" exit 1fi# compilerm -rf TESTDIR; mkdir TESTDIRcd ./TESTDIRmkdir -p $classdir${JAVAC} -d $classdir ../$name.java ../TestUtil.java > ../$name.compileout 2>&1if [ $? != 0 -o -s ../$name.compileout ]; then error "compilation of $name failed, see $name.compileout" exit 1firm -f ../$name.compileout# find input and error fileinfile=../$name.testinif [ ! -f $infile ]; then infile=/dev/nullfi# run and diff resultsrm -rf TESTDIRif [ "$stdinflag" = y ]then ${JAVA} com.sleepycat.test.$name $TEST_ARGS >../$name.out 2>../$name.errelse ${JAVA} com.sleepycat.test.$name $TEST_ARGS <$infile >../$name.out 2>../$name.errficd ..testerr=$name.testerrif [ ! -f $testerr ]; then testerr=/dev/nullfitestout=$name.testoutif [ ! -f $testout ]; then testout=/dev/nullficompare_result $testout $name.outcompare_result $testerr $name.errrm -rf TESTDIRexit $ecode
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -