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 $BACKMETA = metano ; then
22 echo "meta backend not available, test skipped"
26 # to be removed some time...
27 if test "x$TEST_META" != "xyes" ; then
28 echo "### this test is currently disabled;"
29 echo "### set \"TEST_META=yes\" to enable (at own risk)."
33 echo "### this test is __very__ experimental; enable at own risk"
39 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
41 # NOTE: this could be added to all tests...
42 if test "$BACKEND" = "bdb" -o "$BACKEND" = "hdb" ; then
43 if test "x$DB_CONFIG" != "x" ; then \
44 if test -f $DB_CONFIG ; then
45 echo "==> using DB_CONFIG \"$DB_CONFIG\""
49 echo "==> DB_CONFIG must point to a valid file (ignored)"
52 echo "==> set \"DB_CONFIG\" to the DB_CONFIG file you want to use for the test."
57 echo "Starting slapd on TCP/IP port $PORT1..."
58 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
59 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
61 if test $WAIT != 0 ; then
67 echo "Using ldapsearch to check that slapd is running..."
68 for i in 0 1 2 3 4 5; do
69 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
70 'objectclass=*' > /dev/null 2>&1
72 if test $RC = 0 ; then
75 echo "Waiting 5 seconds for slapd to start..."
78 if test $RC != 0 ; then
79 echo "ldapsearch failed ($RC)!"
80 test $KILLSERVERS != no && kill -HUP $KILLPIDS
84 echo "Using ldapadd to populate the database..."
85 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
86 $LDIFORDERED > $TESTOUT 2>&1
88 if test $RC != 0 ; then
89 echo "ldapadd failed ($RC)!"
90 test $KILLSERVERS != no && kill -HUP $KILLPIDS
94 echo "Starting slapd on TCP/IP port $PORT2..."
95 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
96 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
98 if test $WAIT != 0 ; then
102 KILLPIDS="$KILLPIDS $PID"
104 echo "Using ldapsearch to check that slapd is running..."
105 for i in 0 1 2 3 4 5; do
106 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
107 'objectclass=*' > /dev/null 2>&1
109 if test $RC = 0 ; then
112 echo "Waiting 5 seconds for slapd to start..."
115 if test $RC != 0 ; then
116 echo "ldapsearch failed ($RC)!"
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 echo "Using ldapadd to populate the database..."
122 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
123 $LDIFMETA >> $TESTOUT 2>&1
125 if test $RC != 0 ; then
126 echo "ldapadd failed ($RC)!"
127 test $KILLSERVERS != no && kill -HUP $KILLPIDS
131 echo "Starting slapd on TCP/IP port $PORT3..."
132 . $CONFFILTER $BACKEND $MONITORDB < $METACONF > $CONF3
133 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
135 if test $WAIT != 0 ; then
139 KILLPIDS="$KILLPIDS $PID"
141 echo "Using ldapsearch to check that slapd is running..."
142 for i in 0 1 2 3 4 5; do
143 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
144 'objectclass=*' > /dev/null 2>&1
146 if test $RC = 0 ; then
149 echo "Waiting 5 seconds for slapd to start..."
152 if test $RC != 0 ; then
153 echo "ldapsearch failed ($RC)!"
154 test $KILLSERVERS != no && kill -HUP $KILLPIDS
158 cat /dev/null > $SEARCHOUT
160 mkdir -p $TESTDIR/$DATADIR
161 METABASEDN="o=Example,c=US"
162 for f in $DATADIR/do_* ; do
163 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
166 # add a read that matches only the local database, but selects
167 # also the remote as candidate; this should be removed to compare
168 # execution times with test008...
169 for f in $TESTDIR/$DATADIR/do_read.* ; do
170 echo "ou=Meta,$METABASEDN" >> $f
173 # add a read that matches a referral in the local database only,
174 # but selects also the remote as candidate; this should be removed
175 # to compare execution times with test008...
176 for f in $TESTDIR/$DATADIR/do_read.* ; do
177 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
180 echo "Using tester for concurrent server access..."
181 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
184 if test $RC != 0 ; then
185 echo "slapd-tester failed ($RC)!"
186 test $KILLSERVERS != no && kill -HUP $KILLPIDS
190 echo "Using ldapsearch to retrieve all the entries..."
191 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
192 'objectClass=*' > $SEARCHOUT 2>&1
195 test $KILLSERVERS != no && kill -HUP $KILLPIDS
197 if test $RC != 0 ; then
198 echo "ldapsearch failed ($RC)!"
202 echo "Filtering ldapsearch results..."
203 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
204 echo "Filtering original ldif used to create database..."
205 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
206 echo "Comparing filter output..."
207 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
209 if test $? != 0 ; then
210 echo "comparison failed - meta search/modification didn't succeed"
214 echo ">>>>> Test succeeded"