📄 t.systest
字号:
#! /bin/sh# Note: When run via "make check", test output files are automatically deleted.# When run from the command line, output files are left in directory# systest.YYYYMMDD. This is useful when something is different.## ./inputs - test inputs# ./outputs - known correct outputs## systest.YYYYMMDD:# directory containing individual output filesNODB=1 . ${srcdir=.}/t.frameCONFIG="${TMPDIR}/test.cf"OPTS="-c ${CONFIG} -y 0"cat <<EOF > ${CONFIG}robx=0.415min_dev=0.0ham_cutoff=0.10spam_cutoff=0.95spam_header_name=X-Bogositystats_in_header=YEOFmap_rc(){ ( set +e eval "$@" a=$? [ $a -eq 0 ] && exit 0 [ $a -eq 1 ] && exit 0 [ $a -eq 2 ] && exit 0 exit $a )}# Expected spamicity values (11/17/02 13:13):## 1 g v X-Bogosity: Ham, spamicity=0.000000# 1 r v X-Bogosity: Ham, spamicity=0.402296# 2a g vv X-Bogosity: Spam, spamicity=1.000000# 2a r vv X-Bogosity: Ham, spamicity=0.527095# 2b g vv X-Bogosity: Spam, spamicity=1.000000# 2b g vvv X-Bogosity: Spam, spamicity=1.000000# 2b r vv X-Bogosity: Spam, spamicity=0.540124# 2b r vvv X-Bogosity: Spam, spamicity=0.540124# 3 g vvv X-Bogosity: Spam, spamicity=1.000000# 3 r vvv X-Bogosity: Spam, spamicity=0.540316BOGOFILTER_DIR="${TMPDIR}"export BOGOFILTER_DIR$BOGOFILTER $OPTS -s < ${SYSTEST}/inputs/spam.mbx$BOGOFILTER $OPTS -n < ${SYSTEST}/inputs/good.mbxfor f in $BOGOFILTER_DIR/*.${DB_EXT} ; do n=`basename $f .${DB_EXT}` $BOGOUTIL -C -d $BOGOFILTER_DIR/$n.${DB_EXT} > $BOGOFILTER_DIR/$n.txtdoneif [ $verbose -ne 0 ]; then ls -l $BOGOFILTER_DIR/*list.txtfi## run tests for msg.1.txt, msg.2.txt, and msg.3.txt#for tst in 1.1.v.yes 2.2a.vv.yes 2.2a.vvv.no 3.3.vvv.no ; do in=`echo $tst | tr "." " " | $AWK '{print $1}'` out=`echo $tst | tr "." " " | $AWK '{print $2}'` ver=`echo $tst | tr "." " " | $AWK '{print $3}'` sih=`echo $tst | tr "." " " | $AWK '{print $4}'` map_rc $BOGOFILTER $OPTS --stats-in-header=$sih -$ver 2>/dev/null \ < ${SYSTEST}/inputs/msg.$in.txt > ${TMPDIR}/out || : sed s/,.version=.*// < ${TMPDIR}/out > ${TMPDIR}/msg.$out.$verdone## classify msg.2.txt a second time and rerun tests# (expect different results from first run)#$BOGOFILTER $OPTS -s < ${SYSTEST}/inputs/msg.3.txtfor tst in 2.2b.vv.yes 2.2b.vvv.no ; do in=`echo $tst | tr "." " " | $AWK '{print $1}'` out=`echo $tst | tr "." " " | $AWK '{print $2}'` ver=`echo $tst | tr "." " " | $AWK '{print $3}'` sih=`echo $tst | tr "." " " | $AWK '{print $4}'` map_rc $BOGOFILTER $OPTS --stats-in-header=$sih -$ver 2>/dev/null \ < ${SYSTEST}/inputs/msg.$in.txt > ${TMPDIR}/out sed s/,.version=.*// < ${TMPDIR}/out > ${TMPDIR}/msg.$out.$verdoneif [ $verbose -eq 0 ]; then rm -f $BOGOFILTER_DIR/*.${DB_EXT}firm -f ${CONFIG}if [ "$BF_SAVEDIR" ] ; then . ${srcdir}/t.save ; fifor i in $OUTPUTS/msg.*.v* ; do j=`basename $i` if [ $verbose -eq 0 ]; then cmp $i ${TMPDIR}/$j else set +e diff $DIFF_BRIEF $i ${TMPDIR}/$j fidone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -