]> git.sur5r.net Git - openldap/blob - tests/scripts/test008-concurrency
815cdaf79e894980102773ee4662922003679c2f
[openldap] / tests / scripts / test008-concurrency
1 #!/bin/sh
2
3 if [ $# -eq 0 ]; then
4         SRCDIR="."
5 else
6         SRCDIR=$1; shift
7 fi
8 if [ $# -eq 1 ]; then
9         BDB2=$1; shift
10 fi
11
12 echo "running defines.sh $SRCDIR $BDB2"
13
14 . $SRCDIR/scripts/defines.sh $SRCDIR $BDB2
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 -i $LDIF -e ../servers/slapd/tools
24 RC=$?
25 if [ $RC != 0 ]; then
26         echo "ldif2ldbm failed!"
27         exit $RC
28 fi
29
30 echo "Starting slapd on TCP/IP port $PORT..."
31 $SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
32 PID=$!
33
34 echo "Waiting 5 seconds for slapd to start..."
35 sleep 5
36
37 echo "Using tester for concurrent server access..."
38 $SLAPDTESTER -b "$BASEDN" -d "$DATADIR" -h localhost -p $PORT -D "$MANAGERDN" -w $PASSWD -l 100
39 RC=$?
40
41 if [ $RC != 0 ]; then
42         echo "slapd-tester failed!"
43         exit $RC
44 fi 
45
46 echo "Using ldapsearch to retrieve all the entries..."
47 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
48                         'objectClass=*' > $SEARCHOUT 2>&1
49 RC=$?
50
51 kill -HUP $PID
52
53 if [ $RC != 0 ]; then
54         echo "ldapsearch failed!"
55         exit $RC
56 fi
57
58 echo "Comparing retrieved entries to LDIF file used to create database"
59 cmp $SEARCHOUT $LDIF
60 if [ $? != 0 ]; then
61         echo "comparison failed - database was not created correctly"
62         exit 1
63 fi
64
65 echo ">>>>> Test succeeded"
66
67
68 exit 0