]> git.sur5r.net Git - openldap/blob - tests/scripts/test012-glue-populate
Fix typo in killpid
[openldap] / tests / scripts / test012-glue-populate
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
6
7 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
8
9 echo "Starting slapd on TCP/IP port $PORT..."
10 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $CONF1
11 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
12 PID=$!
13 if test $WAIT != 0 ; then
14     echo PID $PID
15     read foo
16 fi
17 KILLPIDS="$PID"
18
19 echo "Using ldapsearch to check that slapd is running..."
20 for i in 0 1 2 3 4 5; do
21         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
22                 'objectclass=*' > /dev/null 2>&1
23         RC=$?
24         if test $RC = 0 ; then
25                 break
26         fi
27         echo "Waiting 5 seconds for slapd to start..."
28         sleep 5
29 done
30
31 echo "Using ldapadd to populate the glued database..."
32 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
33         $LDIFORDERED > $TESTOUT 2>&1
34 RC=$?
35 if test $RC != 0 ; then
36         echo "ldapadd failed ($RC)!"
37         test $KILLSERVERS != no && kill -HUP $KILLPIDS
38         exit $RC
39 fi
40
41 echo "Using ldapsearch to read all the entries..."
42 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
43         'objectclass=*' > $SEARCHOUT 2>&1
44 RC=$?
45
46 test $KILLSERVERS != no && kill -HUP $KILLPIDS
47
48 if test $RC != 0 ; then
49         echo "ldapsearch failed ($RC)!"
50         exit $RC
51 fi
52
53 echo "Filtering ldapsearch results..."
54 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
55 echo "Filtering original ldif used to create database..."
56 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
57 echo "Comparing filter output..."
58 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
59
60 if test $? != 0 ; then
61         echo "comparison failed - database was not created correctly"
62         exit 1
63 fi
64
65 echo ">>>>> Test succeeded"
66 exit 0