📄 t.regtest
字号:
#! /bin/sh# t.regtest## test the registration options, i.e. '-s', '-n', '-S', and '-N'# Note: When run via "make check", test output files are automatically deleted.# When run from the command line, output files are left in directory# regtest.YYYYMMDD. This is useful when something is different.## ./inputs - test inputs# ./outputs - known correct outputs## regtest.YYYYMMDD:# output files contain wordlist contentsrelpath="`pwd`/.."NODB=1 . ${srcdir=.}/t.frameINPUT="${srcdir}/inputs"#opts="-x rw -vvvv"OPTS="-C -y 0"check_counts(){ if [ $verbose -ne 0 ]; then echo "test #$T" fi if [ -f $BOGOFILTER_DIR/goodlist.${DB_EXT} ] ; then g=`$BOGOUTIL -C -d $BOGOFILTER_DIR/goodlist.${DB_EXT} | grep -v " 0 " | tee $TMPDIR/good.$T.out | wc -l` s=`$BOGOUTIL -C -d $BOGOFILTER_DIR/spamlist.${DB_EXT} | grep -v " 0 " | tee $TMPDIR/spam.$T.out | wc -l` else $BOGOUTIL -C -d $BOGOFILTER_DIR/wordlist.${DB_EXT} > $TMPDIR/word.$T.out g=`grep -v " 0$" < $TMPDIR/word.$T.out | tee $TMPDIR/good.$T.out | wc -l` s=`grep -v " 0 " < $TMPDIR/word.$T.out | tee $TMPDIR/spam.$T.out | wc -l` fi WANT=`printf "%d.%d" $S $G` HAVE=`printf "%d.%d" $s $g` if [ $verbose -ne 0 ]; then echo want: $WANT, have: $HAVE fi if [ ! "$WANT" = "$HAVE" ] ; then if [ $verbose -eq 0 ] ; then exit 1 fi fi}create_empty_wordlist# populate goodlist and spamlistT=1 # test #1S=32 # expected tokens from spam messageG=36 # expected tokens from good message$BOGOFILTER $OPTS -s -I $INPUT/msg.regtest.s$BOGOFILTER $OPTS -n -I $INPUT/msg.regtest.ncheck_counts# move msg.regtest.n from goodlist to spamlist in two separate stepsT=2.1 # test #2.1S=32 # expected tokens from spam messageG=0 # expected tokens from good message$BOGOFILTER $OPTS -N -I $INPUT/msg.regtest.ncheck_countsT=2.2 # test #2.2S=60 # expected tokens from spam messageG=0 # expected tokens from good message$BOGOFILTER $OPTS -s -I $INPUT/msg.regtest.ncheck_counts# move msg.regtest.n from goodlist to spamlist in one big stepT=3 # test #3S=60 # expected tokens from spam messageG=0 # expected tokens from good messagecreate_empty_wordlist$BOGOFILTER $OPTS -s -I $INPUT/msg.regtest.s$BOGOFILTER $OPTS -n -I $INPUT/msg.regtest.n$BOGOFILTER $OPTS -Ns -I $INPUT/msg.regtest.ncheck_counts# move msg.regtest.s from spamlist to goodlist in one big stepT=4 # test #4S=0 # expected tokens from spam messageG=60 # expected tokens from good messagecreate_empty_wordlist$BOGOFILTER $OPTS -s -I $INPUT/msg.regtest.s$BOGOFILTER $OPTS -n -I $INPUT/msg.regtest.n$BOGOFILTER $OPTS -Sn -I $INPUT/msg.regtest.scheck_counts
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -