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
45 echo "Using ldapsearch to check that slapd is running..."
46 for i in 0 1 2 3 4 5; do
47 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
48 'objectclass=*' > /dev/null 2>&1
50 if test $RC = 0 ; then
53 echo "Waiting 5 seconds for slapd to start..."
56 if test $RC != 0 ; then
57 echo "ldapsearch failed ($RC)!"
58 test $KILLSERVERS != no && kill -HUP $KILLPIDS
62 echo "Using ldapadd to populate the database..."
63 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
64 $LDIFORDERED > $TESTOUT 2>&1
66 if test $RC != 0 ; then
67 echo "ldapadd failed ($RC)!"
68 test $KILLSERVERS != no && kill -HUP $KILLPIDS
72 echo "Starting slapd on TCP/IP port $PORT2..."
73 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
74 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
76 if test $WAIT != 0 ; then
80 KILLPIDS="$KILLPIDS $PID"
82 echo "Using ldapsearch to check that slapd is running..."
83 for i in 0 1 2 3 4 5; do
84 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
85 'objectclass=*' > /dev/null 2>&1
87 if test $RC = 0 ; then
90 echo "Waiting 5 seconds for slapd to start..."
93 if test $RC != 0 ; then
94 echo "ldapsearch failed ($RC)!"
95 test $KILLSERVERS != no && kill -HUP $KILLPIDS
99 echo "Using ldapadd to populate the database..."
100 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
101 $LDIFMETA >> $TESTOUT 2>&1
103 if test $RC != 0 ; then
104 echo "ldapadd failed ($RC)!"
105 test $KILLSERVERS != no && kill -HUP $KILLPIDS
109 echo "Starting slapd on TCP/IP port $PORT3..."
110 . $CONFFILTER $BACKEND $MONITORDB < $GLUELDAPCONF > $CONF3
111 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
113 if test $WAIT != 0 ; then
117 KILLPIDS="$KILLPIDS $PID"
119 echo "Using ldapsearch to check that slapd is running..."
120 for i in 0 1 2 3 4 5; do
121 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
122 'objectclass=*' > /dev/null 2>&1
124 if test $RC = 0 ; then
127 echo "Waiting 5 seconds for slapd to start..."
130 if test $RC != 0 ; then
131 echo "ldapsearch failed ($RC)!"
132 test $KILLSERVERS != no && kill -HUP $KILLPIDS
136 cat /dev/null > $SEARCHOUT
138 mkdir -p $TESTDIR/$DATADIR
139 METABASEDN="o=Example,c=US"
140 for f in $DATADIR/do_* ; do
141 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
144 # add a read that matches only the local database, but selects
145 # also the remote as candidate; this should be removed to compare
146 # execution times with test008...
147 for f in $TESTDIR/$DATADIR/do_read.* ; do
148 echo "ou=Meta,$METABASEDN" >> $f
151 # add a read that matches a referral in the local database only,
152 # but selects also the remote as candidate; this should be removed
153 # to compare execution times with test008...
154 for f in $TESTDIR/$DATADIR/do_read.* ; do
155 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
158 echo "Using tester for concurrent server access..."
159 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
162 if test $RC != 0 ; then
163 echo "slapd-tester failed ($RC)!"
164 test $KILLSERVERS != no && kill -HUP $KILLPIDS
168 echo "Using ldapsearch to retrieve all the entries..."
169 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
170 '(objectClass=*)' > $SEARCHOUT 2>&1
173 test $KILLSERVERS != no && kill -HUP $KILLPIDS
175 if test $RC != 0 ; then
176 echo "ldapsearch failed ($RC)!"
180 echo "Filtering ldapsearch results..."
181 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
182 echo "Filtering original ldif used to create database..."
183 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
184 echo "Comparing filter output..."
185 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
187 if test $? != 0 ; then
188 echo "comparison failed - meta search/modification didn't succeed"
192 echo ">>>>> Test succeeded"