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 if test "$BACKEND" != "bdb" && test "$BACKEND" != "hdb" ; then
16 echo "Test does not support $BACKEND"
20 echo "running defines.sh"
21 . $SRCDIR/scripts/defines.sh
23 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
25 echo "Running slapadd to build glued slapd databases..."
26 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $CONF1
27 $SLAPADD -d $LVL -f $CONF1 -l $LDIFORDERED > $SLAPADDLOG1 2>&1
29 if test $RC != 0 ; then
30 echo "slapadd failed ($RC)!"
35 mkdir $DBDIR2A $DBDIR1B
36 cp -pr $DBDIR1C $DBDIR2C
38 echo "Starting slapd 1 on TCP/IP port $PORT1..."
39 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF1 > $CONF1
40 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
42 if test $WAIT != 0 ; then
50 echo "Using ldapsearch to check that slapd 1 is running..."
51 for i in 0 1 2 3 4 5; do
52 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
53 '(objectclass=*)' > /dev/null 2>&1
55 if test $RC = 0 ; then
58 echo "Waiting 5 seconds for slapd to start..."
62 echo "Starting slapd 2 on TCP/IP port $PORT2..."
63 . $CONFFILTER $BACKEND $MONITORDB < $GLUESYNCCONF2 > $CONF2
64 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
66 if test $WAIT != 0 ; then
70 KILLPIDS="$KILLPIDS $PID"
74 echo "Using ldapsearch to check that slapd 2 is running..."
75 for i in 0 1 2 3 4 5; do
76 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
77 '(objectclass=*)' > /dev/null 2>&1
79 if test $RC = 0 ; then
82 echo "Waiting 5 seconds for slapd to start..."
86 echo "Waiting 15 seconds for shadow subtrees to sync..."
89 for P in $PORT1 $PORT2 ; do
90 echo "Using ldapsearch to read all the entries from port $P..."
91 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $P \
92 -S "" '(objectclass=*)' > $SEARCHOUT 2>&1
95 if test $RC != 0 ; then
96 echo "ldapsearch failed ($RC)!"
97 test $KILLSERVERS != no && kill -HUP $KILLPIDS
101 echo "Filtering ldapsearch results..."
102 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
103 echo "Filtering original ldif used to create database..."
104 . $LDIFFILTER < $GLUESYNCOUT > $LDIFFLT
105 echo "Comparing filter output..."
106 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
108 if test $? != 0 ; then
109 echo "comparison failed - database was not created correctly"
110 test $KILLSERVERS != no && kill -HUP $KILLPIDS
115 test $KILLSERVERS != no && kill -HUP $KILLPIDS
117 echo ">>>>> Test succeeded"