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