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