]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test007-replication
Add '=' to printableString to be consistent with ASN.1 description
[openldap] / tests / scripts / test007-replication
index 07b60921abf6b1902c159bb32903a3867282b35d..850052f87d0fd4ee2a25434c1d8b962989512fcf 100755 (executable)
@@ -1,6 +1,18 @@
 #! /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."
@@ -35,11 +35,13 @@ echo "Cleaning up in $REPLDIR..."
 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..."
@@ -73,8 +75,9 @@ $LDAPADD -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
        $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
 
@@ -148,8 +151,9 @@ $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
        '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
 
@@ -158,23 +162,25 @@ $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \
        '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"