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