📄 t.bulkmode
字号:
#!/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# bulkmode.YYYYMMDD. This is useful when something is different.## ./inputs - test inputs# ./outputs - known correct outputs# esp. bulkmode.out## ./bulkmode.YYYYMMDD:# directory containing individual output filesNODB=1 . ${srcdir=.}/t.framemap_rc(){ ( set +e eval "$@" a=$? [ $a -eq 0 ] && exit 0 [ $a -eq 1 ] && exit 0 [ $a -eq 2 ] && exit 0 exit $a )}if [ -d $BOGOFILTER_DIR ] ; then rm -f $BOGOFILTER_DIR/* ; else : ; fimkdir -p $BOGOFILTER_DIR$BOGOFILTER -C -s < ${SYSTEST}/inputs/spam.mbx$BOGOFILTER -C -n < ${SYSTEST}/inputs/good.mbx#for f in $BOGOFILTER_DIR/*.${DB_EXT} ; do# o=`echo $f | sed s@.${DB_EXT}@.txt@`# $BOGOUTIL -d $f > $o#done# [ $verbose -gt 0 ] && $BOGOUTIL -w $BOGOFILTER_DIR .MSG_COUNT#V="-vvv" # verbosity levelOPT="-t -v -D $V"pattern="${SYSTEST}/inputs/msg.?.txt"CFG="${TMPDIR}/test.cf"# Fisher tristatecat <<EOF > $CFGrobx=0.415min_dev=0.1ham_cutoff=0.1spam_cutoff=0.95terse_format = %1.1c %dspamicity_tags = S,h,uspamicity_formats = %6.2e %6.2e %0.6fblock_on_subnets=yesreplace_nonascii_characters=yesEOF## run tests for msg.[1-8].txt#BOGOFILTER="$BOGOFILTER -c $CFG $OPT"# test scoring of individual filesNAME="bulk-single"( for f in $pattern ; do echo $f `$BOGOFILTER -e -I $f` ; done ) | \ sed s@.*inputs/@./inputs/@ >${TMPDIR}/$NAME.out# test scoring of files listed on stdinNAME="bulk-stdin"ls $pattern | $BOGOFILTER -b | \ sed s@.*inputs/@./inputs/@ >${TMPDIR}/$NAME.out# test scoring of files listed on linendNAME="bulk-linend"$BOGOFILTER -B `ls $pattern` | \ sed s@.*inputs/@./inputs/@ >${TMPDIR}/$NAME.out# test scoring each file twice (using linend)NAME="bulk-double-1"for f in $pattern ; do map_rc $BOGOFILTER -B $f $f | \ sed s@.*inputs/@./inputs/@ >> ${TMPDIR}/$NAME.tmpdonesort -u < ${TMPDIR}/$NAME.tmp > ${TMPDIR}/$NAME.out# test scoring each file twice (using linend), when files are without "From " linesNAME="bulk-double-2"for f in $pattern ; do t="${TMPDIR}/`basename $f`" $GREP -v "^From "< $f > $t map_rc $BOGOFILTER -B $t $t | \ sed s@.*/@./inputs/@ >> ${TMPDIR}/$NAME.tmpdonesort -u < ${TMPDIR}/$NAME.tmp > ${TMPDIR}/$NAME.out# test scoring of individual files using msg-count formatNAME="bogolex-single"for f in $pattern ; do map_rc "$BOGOTUNE -c $CFG -M $f | $BOGOFILTER >> ${TMPDIR}/$NAME.out"done# test scoring of mbox batch of msg-count messagesNAME="bogolex-mbox"cat $pattern > ${TMPDIR}/test.frmap_rc $BOGOFILTER -M < ${TMPDIR}/test.fr > ${TMPDIR}/$NAME.outNAME="bogolex-batch"cat /dev/null > ${TMPDIR}/test.blfor f in $pattern ; do map_rc "$BOGOTUNE -c $CFG -M $f >> ${TMPDIR}/test.bl"donemap_rc $BOGOFILTER -M < ${TMPDIR}/test.bl > ${TMPDIR}/$NAME.outif [ "$BF_SAVEDIR" ] ; then . ${srcdir}/t.save ; fiCORRECT="${OUTPUTS}/bulkmode.out"for OUT in ${TMPDIR}/bulk-*.out ; do if [ $verbose -eq 0 ]; then cmp $CORRECT $OUT else diff $DIFF_BRIEF $CORRECT $OUT fidoneCORRECT="${OUTPUTS}/bogolex.out"for OUT in ${TMPDIR}/bogolex-*.out ; do if [ $verbose -eq 0 ]; then cmp $CORRECT $OUT else diff $DIFF_BRIEF $CORRECT $OUT fidone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -