]> git.sur5r.net Git - openldap/blob - tests/scripts/test011-glue-slapadd
Add missing 'kill -HUP $KILLPIDS' statement before an exit.
[openldap] / tests / scripts / test011-glue-slapadd
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2005 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
15
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
18
19 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
20
21 echo "Running slapadd to build glued slapd databases..."
22 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $CONF1
23 $SLAPADD -d $LVL -f $CONF1 -l $LDIFORDERED > $SLAPADDLOG1 2>&1
24 RC=$?
25 if test $RC != 0 ; then
26         echo "slapadd failed ($RC)!"
27         exit $RC
28 fi
29
30 echo "Starting slapd on TCP/IP port $PORT1..."
31 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
32 PID=$!
33 if test $WAIT != 0 ; then
34     echo PID $PID
35     read foo
36 fi
37 KILLPIDS="$PID"
38
39 echo "Using ldapsearch to retrieve all the entries..."
40 for i in 0 1 2 3 4 5; do
41         $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
42         RC=$?
43         if test $RC = 0 ; then
44                 break
45         fi
46         echo "Waiting 5 seconds for slapd to start..."
47         sleep 5
48 done
49
50 if test $RC != 0 ; then
51         echo "ldapsearch failed ($RC)!"
52         test $KILLSERVERS != no && kill -HUP $KILLPIDS
53         exit $RC
54 fi
55
56 echo "Filtering ldapsearch results..."
57 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
58 echo "Filtering original ldif used to create database..."
59 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
60 echo "Comparing filter output..."
61 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
62
63 if test $? != 0 ; then
64         echo "comparison failed - database was not created correctly"
65         echo $SEARCHFLT $LDIFFLT
66         $DIFF $SEARCHFLT $LDIFFLT
67         test $KILLSERVERS != no && kill -HUP $KILLPIDS
68         exit 1
69 fi
70
71 echo "Testing sizelimit..."
72 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s one -z 2 > $SEARCHOUT 2>&1
73 RC=$?
74 if test $RC = 0 ; then
75         echo "sizelimit not detected at end of search."
76         test $KILLSERVERS != no && kill -HUP $KILLPIDS
77         exit 1
78 fi
79
80 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 -z 9 objectclass=OpenLDAPPerson > $SEARCHOUT 2>&1
81 RC=$?
82 if test $RC = 0 ; then
83         echo "sizelimit not detected at middle of search."
84         test $KILLSERVERS != no && kill -HUP $KILLPIDS
85         exit 1
86 fi
87
88 test $KILLSERVERS != no && kill -HUP $KILLPIDS
89
90 echo ">>>>> Test succeeded"
91 exit 0