2 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ## Copyright 1998-2005 The OpenLDAP Foundation.
5 ## All rights reserved.
7 ## Redistribution and use in source and binary forms, with or without
8 ## modification, are permitted only as authorized by the OpenLDAP
11 ## A copy of this license is available in the file LICENSE in the
12 ## top-level directory of the distribution or, alternatively, at
13 ## <http://www.OpenLDAP.org/license.html>.
15 echo "running defines.sh"
16 . $SRCDIR/scripts/defines.sh
18 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
20 echo "Running slapadd to build glued slapd databases..."
21 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $CONF1
22 $SLAPADD -d $LVL -f $CONF1 -l $LDIFORDERED > $SLAPADDLOG1 2>&1
24 if test $RC != 0 ; then
25 echo "slapadd failed ($RC)!"
30 mkdir $DBDIR2A $DBDIR1B
31 cp -pr $DBDIR1C $DBDIR2C
33 echo "Starting slapd 1 on TCP/IP port $PORT1..."
34 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF1 > $CONF1
35 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
37 if test $WAIT != 0 ; then
45 echo "Starting slapd 2 on TCP/IP port $PORT2..."
46 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF2 > $CONF2
47 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
49 if test $WAIT != 0 ; then
53 KILLPIDS="$KILLPIDS $PID"
57 echo "Using ldapsearch to check that slapd 1 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..."
69 echo "Using ldapsearch to check that slapd 2 is running..."
70 for i in 0 1 2 3 4 5; do
71 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
72 '(objectclass=*)' > /dev/null 2>&1
74 if test $RC = 0 ; then
77 echo "Waiting 5 seconds for slapd to start..."
82 echo "Waiting $SLEEP seconds for shadow subtrees to sync..."
85 for P in $PORT1 $PORT2 ; do
86 echo "Using ldapsearch to read all the entries from port $P..."
87 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $P \
88 -S "" '(objectclass=*)' > $SEARCHOUT 2>&1
91 if test $RC != 0 ; then
92 echo "ldapsearch failed ($RC)!"
93 test $KILLSERVERS != no && kill -HUP $KILLPIDS
97 echo "Filtering ldapsearch results..."
98 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
99 echo "Filtering original ldif used to create database..."
100 . $LDIFFILTER < $GLUESYNCOUT > $LDIFFLT
101 echo "Comparing filter output..."
102 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
104 if test $? != 0 ; then
105 echo "comparison failed - database was not created correctly"
106 test $KILLSERVERS != no && kill -HUP $KILLPIDS
111 test $KILLSERVERS != no && kill -HUP $KILLPIDS
113 echo ">>>>> Test succeeded"