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 < $METACONF > $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 cat /dev/null > $SEARCHOUT
133 mkdir -p $TESTDIR/$DATADIR
134 METABASEDN="o=Example,c=US"
135 for f in $DATADIR/do_* ; do
136 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
139 # add a read that matches only the local database, but selects
140 # also the remote as candidate; this should be removed to compare
141 # execution times with test008...
142 for f in $TESTDIR/$DATADIR/do_read.* ; do
143 echo "ou=Meta,$METABASEDN" >> $f
146 echo "Using tester for concurrent server access..."
147 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT2 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 # -r 20
150 if test $RC != 0 ; then
151 echo "slapd-tester failed ($RC)!"
152 test $KILLSERVERS != no && kill -HUP $KILLPIDS
156 echo "Using ldapsearch to retrieve all the entries..."
157 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT2 \
158 'objectClass=*' > $SEARCHOUT 2>&1
161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
163 if test $RC != 0 ; then
164 echo "ldapsearch failed ($RC)!"
168 echo "Filtering ldapsearch results..."
169 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
170 echo "Filtering original ldif used to create database..."
171 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
172 echo "Comparing filter output..."
173 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
175 if test $? != 0 ; then
176 echo "comparison failed - meta search/modification didn't succeed"
180 echo ">>>>> Test succeeded"