1#!/bin/sh
2# test basic maildir style parsing
3PATH=/bin:/usr/bin
4DBACL=$TESTBIN/dbacl
5
6prerequisite_command() {
7    type $2 2>&1 > /dev/null
8    if [ 0 -ne $? ]; then
9        echo "$1: $2 not found, test will be skipped"
10        exit 77
11    fi
12}
13
14prerequisite_command $0 grep
15prerequisite_command $0 cut
16
17DBACL_PATH="`pwd`/`basename $0 .sh`_`date +"%Y%m%dT%H%M%S"`"
18export DBACL_PATH
19
20mkdir "$DBACL_PATH"
21
22$DBACL -l dummy -T email ${sourcedir}/sample.spam-1 ${sourcedir}/sample.spam-2 \
23    > "$DBACL_PATH/out"
24NUM=`head -3 "$DBACL_PATH/dummy" | grep '# hash_size' | cut -d ' ' -f 9`
25
26rm -rf "$DBACL_PATH"
27
28test x$NUM = x"2"