summaryrefslogtreecommitdiff
path: root/test/run_test.sh
blob: de7886014378416fecc7fa7c3df2e8b17ac88a44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

# Check the environment
#
if [ ! -x ../src/kbs ] ; then
    echo kbs not built!
    exit
fi

rm -f log

../src/kbs test-config

OK=1

function fail()
{
    echo "BAD: " $*
    OK=0
}

function good()
{
    echo GOOD: $*
}

if [ "`wc -l log | awk '{print $1}'`" != 8 ] ; then
    fail Incorrect number of lines in log file - expected 8
else
    good Correct number of lines in log file - expected 8
fi

for i in trusted@ freebsd.org good_user ; do
    if [ "`egrep $i log`" != "" ] ; then
	fail Item $i incorrectly deleted
    else
	good Item $i correctly not deleted
    fi
done

for i in bad_user@ microsoft.com bad_user2@ bad_user_uname@ bad_user_hname@ ; do
    if [ "`egrep $i log`" == "" ] ; then
	fail Item $i incorrectly not deleted
    else
	good Item $i correctly deleted
    fi
done

if [ $OK == 1 ] ; then
    echo '**** TEST OK'
else
    echo '**** TEST FAILED'
fi

rm -f log