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 "### 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" -o "$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
68 echo "Using ldapsearch to check that slapd is running..."
69 for i in 0 1 2 3 4 5; do
70 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
71 'objectclass=*' > /dev/null 2>&1
73 if test $RC = 0 ; then
76 echo "Waiting 5 seconds for slapd to start..."
79 if test $RC != 0 ; then
80 echo "ldapsearch failed ($RC)!"
81 test $KILLSERVERS != no && kill -HUP $KILLPIDS
85 echo "Using ldapadd to populate the database..."
86 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
87 $LDIFORDERED > $TESTOUT 2>&1
89 if test $RC != 0 ; then
90 echo "ldapadd failed ($RC)!"
91 test $KILLSERVERS != no && kill -HUP $KILLPIDS
95 echo "Starting slapd on TCP/IP port $PORT2..."
96 . $CONFFILTER $BACKEND $MONITORDB < $METACONF2 > $CONF2
97 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
99 if test $WAIT != 0 ; then
103 KILLPIDS="$KILLPIDS $PID"
105 echo "Using ldapsearch to check that slapd is running..."
106 for i in 0 1 2 3 4 5; do
107 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
108 'objectclass=*' > /dev/null 2>&1
110 if test $RC = 0 ; then
113 echo "Waiting 5 seconds for slapd to start..."
116 if test $RC != 0 ; then
117 echo "ldapsearch failed ($RC)!"
118 test $KILLSERVERS != no && kill -HUP $KILLPIDS
122 echo "Using ldapadd to populate the database..."
123 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
124 $LDIFMETA >> $TESTOUT 2>&1
126 if test $RC != 0 ; then
127 echo "ldapadd failed ($RC)!"
128 test $KILLSERVERS != no && kill -HUP $KILLPIDS
132 echo "Starting slapd on TCP/IP port $PORT3..."
133 . $CONFFILTER $BACKEND $MONITORDB < $METACONF > $CONF3
134 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
136 if test $WAIT != 0 ; then
140 KILLPIDS="$KILLPIDS $PID"
142 echo "Using ldapsearch to check that slapd is running..."
143 for i in 0 1 2 3 4 5; do
144 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
145 'objectclass=*' > /dev/null 2>&1
147 if test $RC = 0 ; then
150 echo "Waiting 5 seconds for slapd to start..."
153 if test $RC != 0 ; then
154 echo "ldapsearch failed ($RC)!"
155 test $KILLSERVERS != no && kill -HUP $KILLPIDS
159 cat /dev/null > $SEARCHOUT
161 mkdir -p $TESTDIR/$DATADIR
162 METABASEDN="o=Example,c=US"
163 for f in $DATADIR/do_* ; do
164 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
167 # add a read that matches only the local database, but selects
168 # also the remote as candidate; this should be removed to compare
169 # execution times with test008...
170 for f in $TESTDIR/$DATADIR/do_read.* ; do
171 echo "ou=Meta,$METABASEDN" >> $f
174 # add a read that matches a referral in the local database only,
175 # but selects also the remote as candidate; this should be removed
176 # to compare execution times with test008...
177 for f in $TESTDIR/$DATADIR/do_read.* ; do
178 echo "cn=Somewhere,ou=Meta,$METABASEDN" >> $f
181 echo "Using tester for concurrent server access..."
182 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
185 if test $RC != 0 ; then
186 echo "slapd-tester failed ($RC)!"
187 test $KILLSERVERS != no && kill -HUP $KILLPIDS
191 echo "Using ldapsearch to retrieve all the entries..."
192 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT3 \
193 'objectClass=*' > $SEARCHOUT 2>&1
196 test $KILLSERVERS != no && kill -HUP $KILLPIDS
198 if test $RC != 0 ; then
199 echo "ldapsearch failed ($RC)!"
203 echo "Filtering ldapsearch results..."
204 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
205 echo "Filtering original ldif used to create database..."
206 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
207 echo "Comparing filter output..."
208 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
210 if test $? != 0 ; then
211 echo "comparison failed - meta search/modification didn't succeed"
215 echo ">>>>> Test succeeded"