]> git.sur5r.net Git - openldap/blob - tests/scripts/test011-glue-slapadd
import fix for logging problem (ITS#3811)
[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         exit $RC
53 fi
54
55 echo "Filtering ldapsearch results..."
56 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
57 echo "Filtering original ldif used to create database..."
58 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
59 echo "Comparing filter output..."
60 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
61
62 if test $? != 0 ; then
63         echo "comparison failed - database was not created correctly"
64         echo $SEARCHFLT $LDIFFLT
65         $DIFF $SEARCHFLT $LDIFFLT
66         test $KILLSERVERS != no && kill -HUP $KILLPIDS
67         exit 1
68 fi
69
70 echo "Testing sizelimit..."
71 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 -s one -z 2 > $SEARCHOUT 2>&1
72 RC=$?
73 if test $RC = 0 ; then
74         echo "sizelimit not detected at end of search."
75         test $KILLSERVERS != no && kill -HUP $KILLPIDS
76         exit 1
77 fi
78
79 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 -z 9 objectclass=OpenLDAPPerson > $SEARCHOUT 2>&1
80 RC=$?
81 if test $RC = 0 ; then
82         echo "sizelimit not detected at middle of search."
83         test $KILLSERVERS != no && kill -HUP $KILLPIDS
84         exit 1
85 fi
86
87 test $KILLSERVERS != no && kill -HUP $KILLPIDS
88
89 echo ">>>>> Test succeeded"
90 exit 0