]> git.sur5r.net Git - openldap/blob - tests/scripts/test008-concurrency
First rounded of changes in prep for 2.2.beta3
[openldap] / tests / scripts / test008-concurrency
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
6
7 mkdir -p $TESTDIR $DBDIR1
8
9 echo "Running slapadd to build slapd database..."
10 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
11 $SLAPADD -f $CONF1 -l $LDIFORDERED
12 RC=$?
13 if test $RC != 0 ; then
14         echo "slapadd failed ($RC)!"
15         exit $RC
16 fi
17
18 echo "Waiting 5 seconds for slapadd to build slapd database..."
19 sleep 5
20
21 echo "Starting slapd on TCP/IP port $PORT1..."
22 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
23 PID=$!
24 if test $WAIT != 0 ; then
25     echo PID $PID
26     read foo
27 fi
28 KILLPIDS="$PID"
29
30 echo "Using ldapsearch to check that slapd is running..."
31 for i in 0 1 2 3 4 5; do
32         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
33                 'objectclass=*' > /dev/null 2>&1
34         RC=$?
35         if test $RC = 0 ; then
36                 break
37         fi
38         echo "Waiting 5 seconds for slapd to start..."
39         sleep 5
40 done
41
42 echo "Using tester for concurrent server access..."
43 $SLAPDTESTER -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l 50
44 RC=$?
45
46 if test $RC != 0 ; then
47         echo "slapd-tester failed ($RC)!"
48         test $KILLSERVERS != no && kill -HUP $KILLPIDS
49         exit $RC
50 fi 
51
52 echo "Using ldapsearch to retrieve all the entries..."
53 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
54                         'objectClass=*' > $SEARCHOUT 2>&1
55 RC=$?
56
57 test $KILLSERVERS != no && kill -HUP $KILLPIDS
58
59 if test $RC != 0 ; then
60         echo "ldapsearch failed ($RC)!"
61         exit $RC
62 fi
63
64 echo "Filtering ldapsearch results..."
65 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
66 echo "Filtering original ldif used to create database..."
67 . $LDIFFILTER < $LDIF > $LDIFFLT
68 echo "Comparing filter output..."
69 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
70
71 if test $? != 0 ; then
72         echo "comparison failed - database was not created correctly"
73         exit 1
74 fi
75
76 echo ">>>>> Test succeeded"
77 exit 0