t.valgrind

来自「一个C语言写的快速贝叶斯垃圾邮件过滤工具」· VALGRIND 代码 · 共 90 行

VALGRIND
90
字号
#!/bin/sh# only run this when valgrind is in the path, skip otherwise# ("exit 77" = skip)## this is a stripped-down version of t.grftestNODB=1 . ${srcdir=.}/t.frameif test "x$BF_RUN_VALGRIND" = x ; then    echo >&2 "----> the following test is skipped, set BF_RUN_VALGRIND=1 to run it"    exit 77fiif test "x$EXE_EXT" = "x_static"; then    exit 77ficase `valgrind --version` in    valgrind-3*)	VALGRIND="$VALGRIND 3>${TMPDIR}/vg.out --log-fd=3"	;;    valgrind-2*)	VALGRIND="$VALGRIND 3>${TMPDIR}/vg.out --logfile-fd=3"	;;    *)	exit 77esac( eval $VALGRIND true  ) 2>/dev/null || exit 77if ( eval $VALGRIND false ) 2>/dev/null ; then exit 77 ; fi# Fisher configcat <<EOF > ${TMPDIR}/cfg.frobx=0.415min_dev=0.1ham_cutoff=0.0EOF# Fisher tristatecat <<EOF > ${TMPDIR}/cfg.trobx=0.415min_dev=0.1ham_cutoff=0.1terse_format = %1.1c %dspamicity_tags = S,h,uspamicity_formats = %6.2e %6.2e %0.6fEOF# suppress valgrind complaints about glibc::strchr.SVG_SUPP=${TMPDIR}/vg.suppcat <<EOF > ${VG_SUPP}{   ignore strchr problem   Memcheck:Cond   fun:strchr}EOF#V="-v"	# verbosity levelrun_test(){    tst="$1"    IN="${SYSTEST}/inputs/msg.$tst.txt"    OT="${TMPDIR}/msg.$tst.$mth"    if [ -n "$V" ] ; then OT="$OT.$V" ; fi    OPTS="-e -t $V $CFG"    eval $VALGRIND --suppressions=${VG_SUPP} $BOGOFILTER $OPTS < $IN > $OT    if test -s $TMPDIR/vg.out ; then cat $TMPDIR/vg.out ; exit 2 ; fi}for mth in f t ; do    BOGOFILTER_DIR="${TMPDIR}/words.$mth"    CFG="-c ${TMPDIR}/cfg.$mth -y 0"    export BOGOFILTER_DIR    if [   -d $BOGOFILTER_DIR ] ; then rm -f $BOGOFILTER_DIR/* ; else : ; fi    mkdir -p $BOGOFILTER_DIR    $BOGOFILTER $CFG -s < ${SYSTEST}/inputs/spam.mbx    $BOGOFILTER $CFG -n < ${SYSTEST}/inputs/good.mbx#   if [ $verbose -gt 0 ] ; then $BOGOUTIL -w $BOGOFILTER_DIR .MSG_COUNT ; fi    for tst in 3 ; do	run_test $tst    donedone

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?