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 echo "### this test is currently disabled; enable at own risk ###"
24 if test $BACKMETA = metano ; then
25 echo "meta backend not available, test skipped"
31 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
33 echo "Starting slapd on TCP/IP port $PORT1..."
34 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
35 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
37 if test $WAIT != 0 ; then
43 echo "Using ldapsearch to check that slapd is running..."
44 for i in 0 1 2 3 4 5; do
45 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
46 'objectclass=*' > /dev/null 2>&1
48 if test $RC = 0 ; then
51 echo "Waiting 5 seconds for slapd to start..."
54 if test $RC != 0 ; then
55 echo "ldapsearch failed ($RC)!"
56 test $KILLSERVERS != no && kill -HUP $KILLPIDS
60 echo "Using ldapadd to populate the database..."
61 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
62 $LDIFORDERED > $TESTOUT 2>&1
64 if test $RC != 0 ; then
65 echo "ldapadd failed ($RC)!"
66 test $KILLSERVERS != no && kill -HUP $KILLPIDS
70 echo "Starting slapd on TCP/IP port $PORT2..."
71 . $CONFFILTER $BACKEND $MONITORDB < $METACONF > $CONF2
72 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
74 if test $WAIT != 0 ; then
78 KILLPIDS="$KILLPIDS $PID"
80 echo "Using ldapsearch to check that slapd is running..."
81 for i in 0 1 2 3 4 5; do
82 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
83 'objectclass=*' > /dev/null 2>&1
85 if test $RC = 0 ; then
88 echo "Waiting 5 seconds for slapd to start..."
91 if test $RC != 0 ; then
92 echo "ldapsearch failed ($RC)!"
93 test $KILLSERVERS != no && kill -HUP $KILLPIDS
97 echo "Using ldapadd to populate the database..."
98 $LDAPADD -D "$METAMANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD < \
99 $LDIFMETA >> $TESTOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapadd failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 cat /dev/null > $SEARCHOUT
109 mkdir -p $TESTDIR/$DATADIR
110 METABASEDN="o=Example,c=US"
111 for f in $DATADIR/do_* ; do
112 sed -e "s;$BASEDN;$METABASEDN;" $f > $TESTDIR/$f
115 echo "Using tester for concurrent server access..."
116 $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT2 -D "cn=Manager,$METABASEDN" -w $PASSWD -l 50 -r 20
119 if test $RC != 0 ; then
120 echo "slapd-tester failed ($RC)!"
121 test $KILLSERVERS != no && kill -HUP $KILLPIDS
125 echo "Using ldapsearch to retrieve all the entries..."
126 $LDAPSEARCH -S "" -b "$METABASEDN" -h $LOCALHOST -p $PORT2 \
127 'objectClass=*' > $SEARCHOUT 2>&1
130 test $KILLSERVERS != no && kill -HUP $KILLPIDS
132 if test $RC != 0 ; then
133 echo "ldapsearch failed ($RC)!"
137 echo "Filtering ldapsearch results..."
138 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
139 echo "Filtering original ldif used to create database..."
140 . $LDIFFILTER < $METACONCURRENCYOUT > $LDIFFLT
141 echo "Comparing filter output..."
142 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
144 if test $? != 0 ; then
145 echo "comparison failed - meta search/modification didn't succeed"
149 echo ">>>>> Test succeeded"