]> git.sur5r.net Git - openldap/blob - tests/scripts/test008-concurrency
9644566ee760fa761a6032d39985c8228a0c4e23
[openldap] / tests / scripts / test008-concurrency
1 #! /bin/sh
2
3 if test $# -eq 0 ; then
4         SRCDIR="."
5 else
6         SRCDIR=$1; shift
7 fi
8 if test $# -eq 1 ; then
9         BACKEND=$1; shift
10 fi
11
12 echo "running defines.sh $SRCDIR $BACKEND"
13
14 . $SRCDIR/scripts/defines.sh
15
16 echo "Datadir is $DATADIR"
17
18 echo "Cleaning up in $DBDIR..."
19
20 rm -f $DBDIR/[!C]*
21
22 echo "Running ldif2ldbm to build slapd database..."
23 $LDIF2LDBM -f $CONF -l $LDIF
24 RC=$?
25 if test $RC != 0 ; then
26         echo "ldif2ldbm failed!"
27         exit $RC
28 fi
29
30 echo "Waiting 5 seconds for ldif2ldbm to build slapd database..."
31 sleep 5
32
33 echo "Starting slapd on TCP/IP port $PORT..."
34 $SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
35 PID=$!
36
37 echo "Using ldapsearch to check that slapd is running..."
38 for i in 0 1 2 3 4 5; do
39         $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
40                 'objectclass=*' > /dev/null 2>&1
41         RC=$?
42         if test $RC = 1 ; then
43                 echo "Waiting 5 seconds for slapd to start..."
44                 sleep 5
45         fi
46 done
47
48 echo "Using tester for concurrent server access..."
49 $SLAPDTESTER -b "$BASEDN" -P "$PROGDIR" -d "$DATADIR" -h localhost -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50
50 RC=$?
51
52 if test $RC != 0 ; then
53         echo "slapd-tester failed!"
54         exit $RC
55 fi 
56
57 echo "Using ldapsearch to retrieve all the entries..."
58 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
59                         'objectClass=*' > $SEARCHOUT 2>&1
60 RC=$?
61
62 kill -HUP $PID
63
64 if test $RC != 0 ; then
65         echo "ldapsearch failed!"
66         exit $RC
67 fi
68
69 echo "Filtering ldapsearch results..."
70 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
71 echo "Filtering original ldif used to create database..."
72 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
73 echo "Comparing filter output..."
74 cmp $SEARCHFLT $LDIFFLT
75
76 if test $? != 0 ; then
77         echo "comparison failed - database was not created correctly"
78         exit 1
79 fi
80
81 echo ">>>>> Test succeeded"
82
83
84 exit 0