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" = "xno" ; then
28 echo '### Test disabled by "TEST_META=no"; unset TEST_META to re-enable'
32 echo "### this test is experimental; in case of problems,"
33 echo "### set \"TEST_META=no\" to disable, and report thru"
34 echo "### the Issue Tracking System <http://www.openldap.org/its/>"
40 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
42 # NOTE: this could be added to all tests...
43 if test "$BACKEND" = "bdb" || test "$BACKEND" = "hdb" ; then
44 if test "x$DB_CONFIG" != "x" ; then \
45 if test -f $DB_CONFIG ; then
46 echo "==> using DB_CONFIG \"$DB_CONFIG\""
50 echo "==> DB_CONFIG must point to a valid file (ignored)"
53 echo "==> set \"DB_CONFIG\" to the DB_CONFIG file you want to use for the test."
58 echo "Starting slapd on TCP/IP port $PORT1..."
59 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
60 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
62 if test $WAIT != 0 ; then
70 echo "Using ldapsearch to check that slapd is running..."
71 for i in 0 1 2 3 4 5; do
72 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
73 'objectclass=*' > /dev/null 2>&1
75 if test $RC = 0 ; then
78 echo "Waiting 5 seconds for slapd to start..."
81 if test $RC != 0 ; then
82 echo "ldapsearch failed ($RC)!"
83 test $KILLSERVERS != no && kill -HUP $KILLPIDS
87 echo "Using ldapadd to populate the database..."
88 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
89 $LDIFORDERED > $TESTOUT 2>&1
91 if test $RC != 0 ; then
92 echo "ldapadd failed ($RC)!"
93 test $KILLSERVERS != no && kill -HUP $KILLPIDS
97 echo "Starting slapd on TCP/IP port $PORT2..."
98 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
99 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
101 if test $WAIT != 0 ; then
105 KILLPIDS="$KILLPIDS $PID"
109 echo "Using ldapsearch to check that slapd is running..."
110 for i in 0 1 2 3 4 5; do
111 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
112 'objectclass=*' > /dev/null 2>&1
114 if test $RC = 0 ; then
117 echo "Waiting 5 seconds for slapd to start..."
120 if test $RC != 0 ; then
121 echo "ldapsearch failed ($RC)!"
122 test $KILLSERVERS != no && kill -HUP $KILLPIDS
126 echo "Using ldapadd to populate the database..."
127 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
128 $LDIFMETA >> $TESTOUT 2>&1
130 if test $RC != 0 ; then
131 echo "ldapadd failed ($RC)!"
132 test $KILLSERVERS != no && kill -HUP $KILLPIDS
136 echo "Starting slapd on TCP/IP port $PORT3..."
137 . $CONFFILTER $BACKEND $MONITORDB < $METACONF > $CONF3
138 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
140 if test $WAIT != 0 ; then
144 KILLPIDS="$KILLPIDS $PID"
148 echo "Using ldapsearch to check that slapd is running..."
149 for i in 0 1 2 3 4 5; do
150 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
151 'objectclass=*' > /dev/null 2>&1
153 if test $RC = 0 ; then
156 echo "Waiting 5 seconds for slapd to start..."
159 if test $RC != 0 ; then
160 echo "ldapsearch failed ($RC)!"
161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
165 cat /dev/null > $SEARCHOUT
167 mkdir -p $TESTDIR/$DATADIR
168 METABASEDN="o=Example,c=US"
169 for f in $DATADIR/do_* ; do
170 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
173 # add a read that matches only the local database, but selects
174 # also the remote as candidate; this should be removed to compare
175 # execution times with test008...
176 for f in $TESTDIR/$DATADIR/do_read.* ; do
177 echo "ou=Meta,$METABASEDN" >> $f
180 # add a read that matches a referral in the local database only,
181 # but selects also the remote as candidate; this should be removed
182 # to compare execution times with test008...
183 for f in $TESTDIR/$DATADIR/do_read.* ; do
184 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
187 echo "Using tester for concurrent server access..."
188 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
191 if test $RC != 0 ; then
192 echo "slapd-tester failed ($RC)!"
193 test $KILLSERVERS != no && kill -HUP $KILLPIDS
197 echo "Using ldapsearch to retrieve all the entries..."
198 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
199 'objectClass=*' > $SEARCHOUT 2>&1
202 test $KILLSERVERS != no && kill -HUP $KILLPIDS
204 if test $RC != 0 ; then
205 echo "ldapsearch failed ($RC)!"
209 echo "Filtering ldapsearch results..."
210 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
211 echo "Filtering original ldif used to create database..."
212 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
213 echo "Comparing filter output..."
214 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
216 if test $? != 0 ; then
217 echo "comparison failed - slapd-meta search/modification didn't succeed"
221 echo ">>>>> Test succeeded"