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 $GLUE = "glueno" ; then
27 echo "glue overlay not available, test skipped"
31 if test $RWM = rwmno ; then
32 echo "rwm (rewrite/remap) overlay not available, test skipped"
38 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
40 echo "Starting slapd on TCP/IP port $PORT1..."
41 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
42 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
44 if test $WAIT != 0 ; then
50 echo "Using ldapsearch to check that slapd is running..."
51 for i in 0 1 2 3 4 5; do
52 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
53 'objectclass=*' > /dev/null 2>&1
55 if test $RC = 0 ; then
58 echo "Waiting 5 seconds for slapd to start..."
61 if test $RC != 0 ; then
62 echo "ldapsearch failed ($RC)!"
63 test $KILLSERVERS != no && kill -HUP $KILLPIDS
67 echo "Using ldapadd to populate the database..."
68 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
69 $LDIFORDERED > $TESTOUT 2>&1
71 if test $RC != 0 ; then
72 echo "ldapadd failed ($RC)!"
73 test $KILLSERVERS != no && kill -HUP $KILLPIDS
77 echo "Starting slapd on TCP/IP port $PORT2..."
78 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
79 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
81 if test $WAIT != 0 ; then
85 KILLPIDS="$KILLPIDS $PID"
87 echo "Using ldapsearch to check that slapd is running..."
88 for i in 0 1 2 3 4 5; do
89 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
90 'objectclass=*' > /dev/null 2>&1
92 if test $RC = 0 ; then
95 echo "Waiting 5 seconds for slapd to start..."
98 if test $RC != 0 ; then
99 echo "ldapsearch failed ($RC)!"
100 test $KILLSERVERS != no && kill -HUP $KILLPIDS
104 echo "Using ldapadd to populate the database..."
105 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
106 $LDIFMETA >> $TESTOUT 2>&1
108 if test $RC != 0 ; then
109 echo "ldapadd failed ($RC)!"
110 test $KILLSERVERS != no && kill -HUP $KILLPIDS
114 echo "Starting slapd on TCP/IP port $PORT3..."
115 . $CONFFILTER $BACKEND $MONITORDB < $GLUELDAPCONF > $CONF3
116 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
118 if test $WAIT != 0 ; then
122 KILLPIDS="$KILLPIDS $PID"
124 echo "Using ldapsearch to check that slapd is running..."
125 for i in 0 1 2 3 4 5; do
126 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
127 'objectclass=*' > /dev/null 2>&1
129 if test $RC = 0 ; then
132 echo "Waiting 5 seconds for slapd to start..."
135 if test $RC != 0 ; then
136 echo "ldapsearch failed ($RC)!"
137 test $KILLSERVERS != no && kill -HUP $KILLPIDS
141 cat /dev/null > $SEARCHOUT
143 mkdir -p $TESTDIR/$DATADIR
144 METABASEDN="o=Example,c=US"
145 for f in $DATADIR/do_* ; do
146 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
149 # add a read that matches only the local database, but selects
150 # also the remote as candidate; this should be removed to compare
151 # execution times with test008...
152 for f in $TESTDIR/$DATADIR/do_read.* ; do
153 echo "ou=Meta,$METABASEDN" >> $f
156 # add a read that matches a referral in the local database only,
157 # but selects also the remote as candidate; this should be removed
158 # to compare execution times with test008...
159 for f in $TESTDIR/$DATADIR/do_read.* ; do
160 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
163 echo "Using tester for concurrent server access..."
164 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
167 if test $RC != 0 ; then
168 echo "slapd-tester failed ($RC)!"
169 test $KILLSERVERS != no && kill -HUP $KILLPIDS
173 echo "Using ldapsearch to retrieve all the entries..."
174 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
175 '(objectClass=*)' > $SEARCHOUT 2>&1
178 test $KILLSERVERS != no && kill -HUP $KILLPIDS
180 if test $RC != 0 ; then
181 echo "ldapsearch failed ($RC)!"
185 echo "Filtering ldapsearch results..."
186 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
187 echo "Filtering original ldif used to create database..."
188 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
189 echo "Comparing filter output..."
190 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
192 if test $? != 0 ; then
193 echo "comparison failed - meta search/modification didn't succeed"
197 echo ">>>>> Test succeeded"