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 if test "x$TEST_META" != "xyes" ; then
27 echo "### this test is currently disabled;"
28 echo "### set \"TEST_META=yes\" to enable (at own risk)."
31 echo "### this test is __very__ experimental; enable at own risk"
36 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
38 if test "x$DB_CONFIG" != "x" -a -f $DB_CONFIG ; then
39 echo "==> using DB_CONFIG $DB_CONFIG"
43 echo "==> set \"DB_CONFIG\" to the location of the DB_CONFIG file"
44 echo "==> you want to use for the test."
47 echo "Starting slapd on TCP/IP port $PORT1..."
48 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
49 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
51 if test $WAIT != 0 ; then
57 echo "Using ldapsearch to check that slapd is running..."
58 for i in 0 1 2 3 4 5; do
59 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
60 'objectclass=*' > /dev/null 2>&1
62 if test $RC = 0 ; then
65 echo "Waiting 5 seconds for slapd to start..."
68 if test $RC != 0 ; then
69 echo "ldapsearch failed ($RC)!"
70 test $KILLSERVERS != no && kill -HUP $KILLPIDS
74 echo "Using ldapadd to populate the database..."
75 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
76 $LDIFORDERED > $TESTOUT 2>&1
78 if test $RC != 0 ; then
79 echo "ldapadd failed ($RC)!"
80 test $KILLSERVERS != no && kill -HUP $KILLPIDS
84 echo "Starting slapd on TCP/IP port $PORT2..."
85 . $CONFFILTER $BACKEND $MONITORDB < $METACONF > $CONF2
86 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
88 if test $WAIT != 0 ; then
92 KILLPIDS="$KILLPIDS $PID"
94 echo "Using ldapsearch to check that slapd is running..."
95 for i in 0 1 2 3 4 5; do
96 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
97 'objectclass=*' > /dev/null 2>&1
99 if test $RC = 0 ; then
102 echo "Waiting 5 seconds for slapd to start..."
105 if test $RC != 0 ; then
106 echo "ldapsearch failed ($RC)!"
107 test $KILLSERVERS != no && kill -HUP $KILLPIDS
111 echo "Using ldapadd to populate the database..."
112 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
113 $LDIFMETA >> $TESTOUT 2>&1
115 if test $RC != 0 ; then
116 echo "ldapadd failed ($RC)!"
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 cat /dev/null > $SEARCHOUT
123 mkdir -p $TESTDIR/$DATADIR
124 METABASEDN="o=Example,c=US"
125 for f in $DATADIR/do_* ; do
126 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
129 for f in $TESTDIR/$DATADIR/do_read.* ; do
130 echo "ou=Meta,$METABASEDN" >> $f
133 echo "Using tester for concurrent server access..."
134 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT2 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 100 -r 20
137 if test $RC != 0 ; then
138 echo "slapd-tester failed ($RC)!"
139 test $KILLSERVERS != no && kill -HUP $KILLPIDS
143 echo "Using ldapsearch to retrieve all the entries..."
144 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT2 \
145 'objectClass=*' > $SEARCHOUT 2>&1
148 test $KILLSERVERS != no && kill -HUP $KILLPIDS
150 if test $RC != 0 ; then
151 echo "ldapsearch failed ($RC)!"
155 echo "Filtering ldapsearch results..."
156 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
157 echo "Filtering original ldif used to create database..."
158 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
159 echo "Comparing filter output..."
160 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
162 if test $? != 0 ; then
163 echo "comparison failed - meta search/modification didn't succeed"
167 echo ">>>>> Test succeeded"