]> git.sur5r.net Git - openldap/blob - tests/scripts/test008-concurrency
Fix VPATH support.
[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
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 "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 "Waiting 5 seconds for slapd to start..."
38 sleep 5
39
40 echo "Using tester for concurrent server access..."
41 $SLAPDTESTER -b "$BASEDN" -P "$PROGDIR" -d "$DATADIR" -h localhost -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50
42 RC=$?
43
44 if [ $RC != 0 ]; then
45         echo "slapd-tester failed!"
46         exit $RC
47 fi 
48
49 echo "Using ldapsearch to retrieve all the entries..."
50 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
51                         'objectClass=*' > $SEARCHOUT 2>&1
52 RC=$?
53
54 kill -HUP $PID
55
56 if [ $RC != 0 ]; then
57         echo "ldapsearch failed!"
58         exit $RC
59 fi
60
61 echo "Comparing retrieved entries to LDIF file used to create database"
62 cmp $SEARCHOUT $LDIF
63 if [ $? != 0 ]; then
64         echo "comparison failed - database was not created correctly"
65         exit 1
66 fi
67
68 echo ">>>>> Test succeeded"
69
70
71 exit 0