#! /bin/sh
# $OpenLDAP$
+SRCDIR="."
+if test $# -ge 1 ; then
+ SRCDIR=$1; shift
+fi
+BACKEND=ldbm
+if test $# -ge 1 ; then
+ BACKEND=$1; shift
+fi
+
+echo "running defines.sh"
+. $SRCDIR/scripts/defines.sh
+
#
# Test replication:
# - start master
# - retrieve database over ldap and compare against expected results
#
-if test $# -eq 0 ; then
- SRCDIR="."
-else
- SRCDIR=$1; shift
-fi
-if test $# -eq 1 ; then
- BACKEND=$1; shift
-fi
-
-echo "running defines.sh $SRCDIR $BACKEND"
-. $SRCDIR/scripts/defines.sh
-
if test ! -x $SLURPD ; then
echo ">>>>> $SLURPD is not executable or do not exist."
echo ">>>>> Test skipped."
rm -f $REPLDIR/[!C]*
echo "Starting master slapd on TCP/IP port $PORT..."
-$SLAPD -f $MASTERCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
+. $CONFFILTER $BACKEND < $MASTERCONF > $DBCONF
+$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
PID=$!
echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
-$SLAPD -f $SLAVECONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
+. $CONFFILTER $BACKEND < $SLAVECONF > $REPLCONF
+$SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
SLAVEPID=$!
echo "Using ldapsearch to check that master slapd is running..."
done
echo "Starting slurpd..."
-$SLURPD -f $MASTERCONF -d ${SLURPD_DEBUG-4} -t $REPLDIR > $SLURPLOG 2>&1 &
+$SLURPD -f $MASTERCONF -d ${SLURPD_DEBUG-5} -t $REPLDIR > $SLURPLOG 2>&1 &
SLURPPID=$!
echo "Using ldapadd to populate the master directory..."
$LDIFORDERED > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapadd failed!"
- kill -HUP $PID $SLAVEPID $SLURPPID
+ echo "ldapadd failed ($RC)!"
+ kill -INT $PID $SLAVEPID
+ kill -KILL $SLURPPID
exit $RC
fi
'objectclass=*' > $MASTEROUT 2>&1
if test $RC != 0 ; then
- echo "ldapsearch failed!"
- kill -HUP $PID $SLAVEPID $SLURPPID
+ echo "ldapsearch failed ($RC)!"
+ kill -INT $PID $SLAVEPID
+ kill -KILL $SLURPPID
exit $RC
fi
'objectclass=*' > $SLAVEOUT 2>&1
if test $RC != 0 ; then
- echo "ldapsearch failed!"
- kill -HUP $PID $SLAVEPID $SLURPPID
+ echo "ldapsearch failed ($RC)!"
+ kill -INT $PID $SLAVEPID
+ kill -KILL $SLURPPID
exit $RC
fi
-kill -HUP $PID $SLAVEPID $SLURPPID
+kill -INT $PID $SLAVEPID
+kill -KILL $SLURPPID
SEARCHOUT=$MASTEROUT
LDIF=$SLAVEOUT
echo "Filtering ldapsearch results..."
-. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
+. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering original ldif used to create database..."
-. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
+. $LDIFFILTER < $LDIF > $LDIFFLT
echo "Comparing retrieved entries from master and slave..."
-$CMP $SEARCHFLT $LDIFFLT
+$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and slave databases differ"