3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
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>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
21 if test $BACKLDAP = ldapno ; then
22 echo "ldap backend not available, test skipped"
26 if test $RWM = rwmno ; then
27 echo "rwm (rewrite/remap) overlay not available, test skipped"
31 if test x$TESTLOOPS = x ; then
37 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
39 echo "Starting slapd on TCP/IP port $PORT1..."
40 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
41 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
43 if test $WAIT != 0 ; then
51 echo "Using ldapsearch to check that slapd is running..."
52 for i in 0 1 2 3 4 5; do
53 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
54 'objectclass=*' > /dev/null 2>&1
56 if test $RC = 0 ; then
59 echo "Waiting 5 seconds for slapd to start..."
62 if test $RC != 0 ; then
63 echo "ldapsearch failed ($RC)!"
64 test $KILLSERVERS != no && kill -HUP $KILLPIDS
68 echo "Using ldapadd to populate the database..."
69 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
70 $LDIFORDERED > $TESTOUT 2>&1
72 if test $RC != 0 ; then
73 echo "ldapadd failed ($RC)!"
74 test $KILLSERVERS != no && kill -HUP $KILLPIDS
78 echo "Starting slapd on TCP/IP port $PORT2..."
79 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
80 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
82 if test $WAIT != 0 ; then
86 KILLPIDS="$KILLPIDS $PID"
90 echo "Using ldapsearch to check that slapd is running..."
91 for i in 0 1 2 3 4 5; do
92 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
93 'objectclass=*' > /dev/null 2>&1
95 if test $RC = 0 ; then
98 echo "Waiting 5 seconds for slapd to start..."
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 echo "Using ldapadd to populate the database..."
108 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
109 $LDIFMETA >> $TESTOUT 2>&1
111 if test $RC != 0 ; then
112 echo "ldapadd failed ($RC)!"
113 test $KILLSERVERS != no && kill -HUP $KILLPIDS
117 echo "Starting slapd on TCP/IP port $PORT3..."
118 . $CONFFILTER $BACKEND $MONITORDB < $GLUELDAPCONF > $CONF3
119 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
121 if test $WAIT != 0 ; then
125 KILLPIDS="$KILLPIDS $PID"
129 echo "Using ldapsearch to check that slapd is running..."
130 for i in 0 1 2 3 4 5; do
131 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
132 'objectclass=*' > /dev/null 2>&1
134 if test $RC = 0 ; then
137 echo "Waiting 5 seconds for slapd to start..."
140 if test $RC != 0 ; then
141 echo "ldapsearch failed ($RC)!"
142 test $KILLSERVERS != no && kill -HUP $KILLPIDS
146 cat /dev/null > $SEARCHOUT
148 mkdir -p $TESTDIR/$DATADIR
149 METABASEDN="o=Example,c=US"
150 for f in $DATADIR/do_* ; do
151 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
154 # add a read that matches only the local database, but selects
155 # also the remote as candidate; this should be removed to compare
156 # execution times with test008...
157 for f in $TESTDIR/$DATADIR/do_read.* ; do
158 echo "ou=Meta,$METABASEDN" >> $f
161 # add a read that matches a referral in the local database only,
162 # but selects also the remote as candidate; this should be removed
163 # to compare execution times with test008...
164 for f in $TESTDIR/$DATADIR/do_read.* ; do
165 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
168 echo "Using tester for concurrent server access..."
169 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 \
170 -D "cn=Manager,$METABASEDN" -w $PASSWD -l $TESTLOOPS -r 20 -F
173 if test $RC != 0 ; then
174 echo "slapd-tester failed ($RC)!"
175 test $KILLSERVERS != no && kill -HUP $KILLPIDS
179 echo "Using ldapsearch to retrieve all the entries..."
180 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
181 '(objectClass=*)' > $SEARCHOUT 2>&1
184 test $KILLSERVERS != no && kill -HUP $KILLPIDS
186 if test $RC != 0 ; then
187 echo "ldapsearch failed ($RC)!"
191 echo "Filtering ldapsearch results..."
192 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
193 echo "Filtering original ldif used to create database..."
194 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
195 echo "Comparing filter output..."
196 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
198 if test $? != 0 ; then
199 echo "comparison failed - slapd-ldap search/modification didn't succeed"
203 echo ">>>>> Test succeeded"
205 test $KILLSERVERS != no && wait