3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2005 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"
33 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
35 echo "Starting slapd on TCP/IP port $PORT1..."
36 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
37 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
39 if test $WAIT != 0 ; then
47 echo "Using ldapsearch to check that slapd is running..."
48 for i in 0 1 2 3 4 5; do
49 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
50 'objectclass=*' > /dev/null 2>&1
52 if test $RC = 0 ; then
55 echo "Waiting 5 seconds for slapd to start..."
58 if test $RC != 0 ; then
59 echo "ldapsearch failed ($RC)!"
60 test $KILLSERVERS != no && kill -HUP $KILLPIDS
64 echo "Using ldapadd to populate the database..."
65 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
66 $LDIFORDERED > $TESTOUT 2>&1
68 if test $RC != 0 ; then
69 echo "ldapadd failed ($RC)!"
70 test $KILLSERVERS != no && kill -HUP $KILLPIDS
74 echo "Starting slapd on TCP/IP port $PORT2..."
75 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
76 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
78 if test $WAIT != 0 ; then
82 KILLPIDS="$KILLPIDS $PID"
86 echo "Using ldapsearch to check that slapd is running..."
87 for i in 0 1 2 3 4 5; do
88 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
89 'objectclass=*' > /dev/null 2>&1
91 if test $RC = 0 ; then
94 echo "Waiting 5 seconds for slapd to start..."
97 if test $RC != 0 ; then
98 echo "ldapsearch failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
103 echo "Using ldapadd to populate the database..."
104 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
105 $LDIFMETA >> $TESTOUT 2>&1
107 if test $RC != 0 ; then
108 echo "ldapadd failed ($RC)!"
109 test $KILLSERVERS != no && kill -HUP $KILLPIDS
113 echo "Starting slapd on TCP/IP port $PORT3..."
114 . $CONFFILTER $BACKEND $MONITORDB < $GLUELDAPCONF > $CONF3
115 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
117 if test $WAIT != 0 ; then
121 KILLPIDS="$KILLPIDS $PID"
125 echo "Using ldapsearch to check that slapd is running..."
126 for i in 0 1 2 3 4 5; do
127 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
128 'objectclass=*' > /dev/null 2>&1
130 if test $RC = 0 ; then
133 echo "Waiting 5 seconds for slapd to start..."
136 if test $RC != 0 ; then
137 echo "ldapsearch failed ($RC)!"
138 test $KILLSERVERS != no && kill -HUP $KILLPIDS
142 cat /dev/null > $SEARCHOUT
144 mkdir -p $TESTDIR/$DATADIR
145 METABASEDN="o=Example,c=US"
146 for f in $DATADIR/do_* ; do
147 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
150 # add a read that matches only the local database, but selects
151 # also the remote as candidate; this should be removed to compare
152 # execution times with test008...
153 for f in $TESTDIR/$DATADIR/do_read.* ; do
154 echo "ou=Meta,$METABASEDN" >> $f
157 # add a read that matches a referral in the local database only,
158 # but selects also the remote as candidate; this should be removed
159 # to compare execution times with test008...
160 for f in $TESTDIR/$DATADIR/do_read.* ; do
161 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
164 echo "Using tester for concurrent server access..."
165 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
168 if test $RC != 0 ; then
169 echo "slapd-tester failed ($RC)!"
170 test $KILLSERVERS != no && kill -HUP $KILLPIDS
174 echo "Using ldapsearch to retrieve all the entries..."
175 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
176 '(objectClass=*)' > $SEARCHOUT 2>&1
179 test $KILLSERVERS != no && kill -HUP $KILLPIDS
181 if test $RC != 0 ; then
182 echo "ldapsearch failed ($RC)!"
186 echo "Filtering ldapsearch results..."
187 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
188 echo "Filtering original ldif used to create database..."
189 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
190 echo "Comparing filter output..."
191 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
193 if test $? != 0 ; then
194 echo "comparison failed - meta search/modification didn't succeed"
198 echo ">>>>> Test succeeded"