From 4c48df91d3399096b9d8f1d8d567c7cc1cfa3f96 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 25 May 1999 19:31:23 +0000 Subject: [PATCH] Update tests to filter create/modify dn/timestamp. --- tests/scripts/acfilter.sh | 2 ++ tests/scripts/all | 16 +++++++--- tests/scripts/defines.sh | 33 ++++++++++++-------- tests/scripts/makeldbm.sh | 6 ++-- tests/scripts/test001-ldif2ldbm | 30 +++++++++++------- tests/scripts/test002-populate | 23 ++++++++------ tests/scripts/test003-search | 51 +++++++++++++++++++------------ tests/scripts/test004-modify | 38 ++++++++++++++--------- tests/scripts/test005-modrdn | 17 ++++++++--- tests/scripts/test006-acls | 33 +++++++++++++------- tests/scripts/test007-replication | 37 ++++++++++++++-------- 11 files changed, 184 insertions(+), 102 deletions(-) create mode 100755 tests/scripts/acfilter.sh diff --git a/tests/scripts/acfilter.sh b/tests/scripts/acfilter.sh new file mode 100755 index 0000000000..22c58c3d0a --- /dev/null +++ b/tests/scripts/acfilter.sh @@ -0,0 +1,2 @@ +#! /bin/sh +egrep -iv '^modifiersname:|^modifytimestamp:|^creatorsname:|^createtimestamp' diff --git a/tests/scripts/all b/tests/scripts/all index 2af48bcc4d..a469a919f0 100755 --- a/tests/scripts/all +++ b/tests/scripts/all @@ -1,11 +1,11 @@ -#!/bin/sh +#! /bin/sh # disable LDAP initialization LDAPNOINIT=true; export LDAPNOINIT echo ">>>>> Executing all LDAP tests..." -if [ $# -eq 0 ]; then +if test $# -eq 0 ; then SRCDIR="." else SRCDIR=$1; shift @@ -13,11 +13,19 @@ fi echo ">>>>> Test Directory: $SRCDIR" +if test $# -eq 0 ; then + BACKEND=ldbm +else + BACKEND=$1; shift +fi + +echo ">>>>> Backend: $BACKEND" + for CMD in $SRCDIR/scripts/test*; do echo ">>>>> Starting `basename $CMD` ..." - $CMD $SRCDIR + $CMD $SRCDIR $BACKEND RC=$? - if [ $RC -eq 0 ]; then + if test $RC -eq 0 ; then echo ">>>>> $CMD completed OK." else echo ">>>>> $CMD failed (exit $RC)" diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index 03337899e2..d1de82f68e 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -1,21 +1,31 @@ + DATADIR=$SRCDIR/data +PROGDIR=./progs LDIF2LDBM=../servers/slapd/tools/ldif2ldbm -SLAPD=../servers/slapd/slapd -SLURPD=../servers/slurpd/slurpd -LDAPSEARCH=../clients/tools/ldapsearch -LDAPMODIFY=../clients/tools/ldapmodify -LDAPMODRDN=../clients/tools/ldapmodrdn -LDAPADD=../clients/tools/ldapadd -LVL=5 -PORT=9009 -SLAVEPORT=9010 -DBDIR=./test-db -REPLDIR=./test-repl CONF=$DATADIR/slapd-master.conf ACLCONF=$DATADIR/slapd-acl.conf MASTERCONF=$DATADIR/slapd-repl-master.conf SLAVECONF=$DATADIR/slapd-repl-slave.conf + +PASSWDCONF=$DATADIR/slapd-passwd.conf + +CLIENTDIR=../clients/tools +#CLIENTDIR=/usr/local/bin + +SLAPD=../servers/slapd/slapd +SLURPD=../servers/slurpd/slurpd +LDAPSEARCH=$CLIENTDIR/ldapsearch +LDAPMODIFY=$CLIENTDIR/ldapmodify +LDAPADD=$CLIENTDIR/ldapadd +LDAPMODRDN=$CLIENTDIR/ldapmodrdn +SLAPDTESTER=$PROGDIR/slapd-tester +LVL=${SLAPD_DEBUG-5} +ADDR=127.0.0.1 +PORT=9009 +SLAVEPORT=9010 +DBDIR=./test-db +REPLDIR=./test-repl LDIF=$DATADIR/test.ldif LDIFORDERED=$DATADIR/test-ordered.ldif BASEDN="o=University of Michigan, c=US" @@ -33,7 +43,6 @@ LDIFFLT=$DBDIR/ldif.flt MASTEROUT=$DBDIR/master.out SLAVEOUT=$DBDIR/slave.out TESTOUT=$DBDIR/ldapsearch.out -TESTOUT_MODRDN=$DBDIR/ldapmodrdn.out SEARCHOUTMASTER=$DATADIR/search.out.master MODIFYOUTMASTER=$DATADIR/modify.out.master ADDDELOUTMASTER=$DATADIR/adddel.out.master diff --git a/tests/scripts/makeldbm.sh b/tests/scripts/makeldbm.sh index bb2aac035c..72cdb3053d 100755 --- a/tests/scripts/makeldbm.sh +++ b/tests/scripts/makeldbm.sh @@ -1,15 +1,15 @@ -#!/bin/sh +#! /bin/sh . scripts/defines.sh echo "Cleaning up in $DBDIR..." -rm -f $DBDIR/* +rm -f $DBDIR/[!C]* echo "Running ldif2ldbm to build slapd database..." $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldif2ldbm failed!" exit $RC fi diff --git a/tests/scripts/test001-ldif2ldbm b/tests/scripts/test001-ldif2ldbm index 64deb66b87..a93b1d8f55 100755 --- a/tests/scripts/test001-ldif2ldbm +++ b/tests/scripts/test001-ldif2ldbm @@ -1,14 +1,17 @@ -#!/bin/sh +#! /bin/sh -if [ $# -eq 0 ]; then +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" +echo "running defines.sh $SRCDIR $BACKEND" -. $SRCDIR/scripts/defines.sh $SRCDIR +. $SRCDIR/scripts/defines.sh echo "Datadir is $DATADIR" @@ -19,13 +22,13 @@ rm -f $DBDIR/[!C]* echo "Running ldif2ldbm to build slapd database..." $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldif2ldbm failed!" exit $RC fi echo "Starting slapd on TCP/IP port $PORT..." -$SLAPD -f $CONF -p $PORT -d $LVL > $MASTERLOG 2>&1 & +$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 & PID=$! echo "Using ldapsearch to retrieve all the entries..." @@ -33,7 +36,7 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ 'objectClass=*' > $SEARCHOUT 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi @@ -41,14 +44,19 @@ done kill -HUP $PID -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" exit $RC fi -echo "Comparing retrieved entries to LDIF file used to create database" -cmp $SEARCHOUT $LDIF -if [ $? != 0 ]; then +echo "Filtering ldapsearch results..." +. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT +echo "Comparing filter output..." +cmp $SEARCHFLT $LDIFFLT + +if test $? != 0 ; then echo "comparison failed - database was not created correctly" exit 1 fi diff --git a/tests/scripts/test002-populate b/tests/scripts/test002-populate index cc7fc7debd..641a3d5c65 100755 --- a/tests/scripts/test002-populate +++ b/tests/scripts/test002-populate @@ -1,19 +1,23 @@ -#!/bin/sh +#! /bin/sh -if [ $# -eq 0 ]; then +if test $# -eq 0 ; then SRCDIR="." else SRCDIR=$1; shift fi +if test $# -eq 1 ; then + BACKEND=$1; shift +fi -. $SRCDIR/scripts/defines.sh $SRCDIR +echo "running defines.sh $SRCDIR $BACKEND" +. $SRCDIR/scripts/defines.sh echo "Cleaning up in $DBDIR..." rm -f $DBDIR/[!C]* echo "Starting slapd on TCP/IP port $PORT..." -$SLAPD -f $CONF -p $PORT -d $LVL > $MASTERLOG 2>&1 & +$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 & PID=$! echo "Using ldapsearch to check that slapd is running..." @@ -21,7 +25,7 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \ 'cn=Monitor' > /dev/null 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi @@ -31,7 +35,7 @@ echo "Using ldapmodify to populate the database..." $LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \ $LDIFORDERED > /dev/null 2>&1 RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapmodify failed!" kill -HUP $PID exit $RC @@ -39,12 +43,11 @@ fi echo "Using ldapsearch to read all the entries..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - 'objectclass=*' | egrep -iv '^creatorsname:|^createtimestamp:' > \ - $SEARCHOUT 2>&1 + 'objectclass=*' > $SEARCHOUT 2>&1 kill -HUP $PID -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" exit $RC fi @@ -56,7 +59,7 @@ echo "Filtering original ldif used to create database..." echo "Comparing filter output..." cmp $SEARCHFLT $LDIFFLT -if [ $? != 0 ]; then +if test $? != 0 ; then echo "comparison failed - database was not created correctly" exit 1 fi diff --git a/tests/scripts/test003-search b/tests/scripts/test003-search index e6d2d6ac9d..03179910f6 100755 --- a/tests/scripts/test003-search +++ b/tests/scripts/test003-search @@ -1,12 +1,16 @@ -#!/bin/sh +#! /bin/sh -if [ $# -eq 0 ]; then +if test $# -eq 0 ; then SRCDIR="." else SRCDIR=$1; shift fi +if test $# -eq 1 ; then + BACKEND=$1; shift +fi -. $SRCDIR/scripts/defines.sh $SRCDIR +echo "running defines.sh $SRCDIR $BACKEND" +. $SRCDIR/scripts/defines.sh echo "Cleaning up in $DBDIR..." @@ -15,13 +19,13 @@ rm -f $DBDIR/[!C]* echo "Running ldif2ldbm to build slapd database..." $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldif2ldbm failed!" exit $RC fi echo "Starting slapd on TCP/IP port $PORT..." -$SLAPD -f $CONF -p $PORT -d $LVL > $MASTERLOG 2>&1 & +$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 & PID=$! echo "Testing slapd searching..." @@ -29,24 +33,24 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ 'cn=Manager' > /dev/null 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi done -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC fi -cat /dev/null > $TESTOUT +cat /dev/null > $SEARCHOUT echo "Testing exact searching..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - 'sn=jensen' >> $TESTOUT 2>&1 -if [ $RC != 0 ]; then + 'sn=jensen' >> $SEARCHOUT 2>&1 +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC @@ -54,8 +58,8 @@ fi echo "Testing OR searching..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - '(|(objectclass=rfc822mailgroup)(sn=jones))' >> $TESTOUT 2>&1 -if [ $RC != 0 ]; then + '(|(objectclass=rfc822mailgroup)(sn=jones))' >> $SEARCHOUT 2>&1 +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC @@ -63,8 +67,8 @@ fi echo "Testing AND matching and ends-with searching..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - '(&(objectclass=rfc822mailgroup)(cn=A*))' >> $TESTOUT 2>&1 -if [ $RC != 0 ]; then + '(&(objectclass=rfc822mailgroup)(cn=A*))' >> $SEARCHOUT 2>&1 +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC @@ -72,9 +76,8 @@ fi echo "Testing NOT searching..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - '(!(objectclass=person))' | grep -v "^modifytimestamp:" \ - >> $TESTOUT 2>&1 -if [ $RC != 0 ]; then + '(!(objectclass=person))' >> $SEARCHOUT 2>&1 +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC @@ -82,9 +85,17 @@ fi kill -HUP $PID -echo "Comparing results" -cmp $TESTOUT $SEARCHOUTMASTER -if [ $? != 0 ]; then +TESTOUT=$SEARCHOUT +LDIF=$SEARCHOUTMASTER + +echo "Filtering ldapsearch results..." +. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT +echo "Comparing filter output..." +cmp $SEARCHFLT $LDIFFLT + +if test $? != 0 ; then echo "Comparison failed" exit 1 fi diff --git a/tests/scripts/test004-modify b/tests/scripts/test004-modify index bea606e7a3..fa3bc01985 100755 --- a/tests/scripts/test004-modify +++ b/tests/scripts/test004-modify @@ -1,12 +1,16 @@ -#!/bin/sh +#! /bin/sh -if [ $# -eq 0 ]; then +if test $# -eq 0 ; then SRCDIR="." else SRCDIR=$1; shift fi +if test $# -eq 1 ; then + BACKEND=$1; shift +fi -. $SRCDIR/scripts/defines.sh $SRCDIR +echo "running defines.sh $SRCDIR $BACKEND" +. $SRCDIR/scripts/defines.sh echo "Cleaning up in $DBDIR..." @@ -15,13 +19,13 @@ rm -f $DBDIR/[!C]* echo "Running ldif2ldbm to build slapd database..." $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldif2ldbm failed!" exit $RC fi echo "Starting slapd on TCP/IP port $PORT..." -$SLAPD -f $CONF -p $PORT -d $LVL > $MASTERLOG 2>&1 & +$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 & PID=$! echo "Testing slapd modify operations..." @@ -29,13 +33,13 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ 'cn=Manager' > /dev/null 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi done -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC @@ -102,7 +106,7 @@ changetype: delete EOMODS RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapmodify failed!" kill -HUP $PID exit $RC @@ -110,18 +114,24 @@ fi echo "Using ldapsearch to retrieve all the entries..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - 'objectClass=*' | egrep -iv '^createtimestamp:|^modifytimestamp:' \ - > $SEARCHOUT 2>&1 + 'objectClass=*' > $SEARCHOUT 2>&1 RC=$? kill -HUP $PID -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" exit $RC fi -echo "Comparing database to reference file" -cmp $SEARCHOUT $MODIFYOUTMASTER -if [ $? != 0 ]; then +LDIF=$MODIFYOUTMASTER + +echo "Filtering ldapsearch results..." +. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT +echo "Comparing filter output..." +cmp $SEARCHFLT $LDIFFLT + +if test $? != 0 ; then echo "comparison failed - modify operations did not complete correctly" exit 1 fi diff --git a/tests/scripts/test005-modrdn b/tests/scripts/test005-modrdn index e6069758f6..70392336cf 100755 --- a/tests/scripts/test005-modrdn +++ b/tests/scripts/test005-modrdn @@ -46,7 +46,8 @@ if test $RC != 0 ; then exit $RC fi -cat /dev/null > $TESTOUT_MODRDN +cat /dev/null > $TESTOUT + # -r used to do remove of old rdn @@ -74,8 +75,7 @@ fi echo "Using ldapsearch to retrieve all the entries..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ - 'objectClass=*' | egrep -iv '^createtimestamp:|^modifytimestamp:' \ - > $SEARCHOUT 2>&1 + 'objectClass=*' > $SEARCHOUT 2>&1 RC=$? kill -HUP $PID if test $RC != 0 ; then @@ -83,8 +83,15 @@ if test $RC != 0 ; then exit $RC fi -echo "Comparing database to reference file" -cmp $SEARCHOUT $MODRDNOUTMASTER +LDIF=$MODRDNOUTMASTER + +echo "Filtering ldapsearch results..." +. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT +echo "Comparing filter output..." +cmp $SEARCHFLT $LDIFFLT + if test $? != 0 ; then echo "comparison failed - modrdn operations did not complete correctly" exit 1 diff --git a/tests/scripts/test006-acls b/tests/scripts/test006-acls index 7a1f0f84f5..58d1215407 100755 --- a/tests/scripts/test006-acls +++ b/tests/scripts/test006-acls @@ -1,12 +1,16 @@ -#!/bin/sh +#! /bin/sh -if [ $# -eq 0 ]; then +if test $# -eq 0 ; then SRCDIR="." else SRCDIR=$1; shift fi +if test $# -eq 1 ; then + BACKEND=$1; shift +fi -. $SRCDIR/scripts/defines.sh $SRCDIR +echo "running defines.sh $SRCDIR $BACKEND" +. $SRCDIR/scripts/defines.sh echo "Cleaning up in $DBDIR..." @@ -15,13 +19,13 @@ rm -f $DBDIR/[!C]* echo "Running ldif2ldbm to build slapd database..." $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldif2ldbm failed!" exit $RC fi echo "Starting slapd on TCP/IP port $PORT..." -$SLAPD -f $ACLCONF -p $PORT -d $LVL > $MASTERLOG 2>&1 & +$SLAPD -f $ACLCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 & PID=$! echo "Testing slapd access control..." @@ -29,13 +33,13 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ 'cn=Monitor' > /dev/null 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi done -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID exit $RC @@ -105,14 +109,21 @@ $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ 'objectClass=*' | . $SRCDIR/scripts/acfilter.sh >> $SEARCHOUT 2>&1 RC=$? kill -HUP $PID -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" exit $RC fi -echo "Comparing database to reference file" -cmp $SEARCHOUT $ACLOUTMASTER -if [ $? != 0 ]; then +LDIF=$ACLOUTMASTER + +echo "Filtering ldapsearch results..." +. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT +echo "Comparing filter output..." +cmp $SEARCHFLT $LDIFFLT + +if test $? != 0 ; then echo "comparison failed - modify operations did not complete correctly" exit 1 fi diff --git a/tests/scripts/test007-replication b/tests/scripts/test007-replication index 472d257678..b3d71c295c 100755 --- a/tests/scripts/test007-replication +++ b/tests/scripts/test007-replication @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh # # Test replication: @@ -10,13 +10,17 @@ # - retrieve database over ldap and compare against expected results # -if [ $# -eq 0 ]; then +if test $# -eq 0 ; then SRCDIR="." else SRCDIR=$1; shift fi +if test $# -eq 1 ; then + BACKEND=$1; shift +fi -. $SRCDIR/scripts/defines.sh $SRCDIR +echo "running defines.sh $SRCDIR $BACKEND" +. $SRCDIR/scripts/defines.sh if test ! -x $SLURPD ; then echo ">>>>> $SLURPD is not executable or do not exist." @@ -30,11 +34,11 @@ echo "Cleaning up in $REPLDIR..." rm -f $REPLDIR/[!C]* echo "Starting master slapd on TCP/IP port $PORT..." -$SLAPD -f $MASTERCONF -p $PORT -d $LVL > $MASTERLOG 2>&1 & +$SLAPD -f $MASTERCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 & PID=$! echo "Starting slave slapd on TCP/IP port $SLAVEPORT..." -$SLAPD -f $SLAVECONF -p $SLAVEPORT -d $LVL > $SLAVELOG 2>&1 & +$SLAPD -f $SLAVECONF -p $SLAVEPORT -d $LVL $TIMING > $SLAVELOG 2>&1 & SLAVEPID=$! echo "Using ldapsearch to check that master slapd is running..." @@ -42,7 +46,7 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \ 'cn=Monitor' > /dev/null 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi @@ -53,7 +57,7 @@ for i in 0 1 2 3 4 5; do $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $SLAVEPORT \ 'cn=Monitor' > /dev/null 2>&1 RC=$? - if [ $RC = 1 ]; then + if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." sleep 5 fi @@ -67,7 +71,7 @@ echo "Using ldapmodify to populate the database..." $LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \ $LDIFORDERED > /dev/null 2>&1 RC=$? -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapmodify failed!" kill -HUP $PID $SLAVEPID $SLURPPID exit $RC @@ -142,7 +146,7 @@ echo "Using ldapsearch to read all the entries from the master..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \ 'objectclass=*' > $MASTEROUT 2>&1 -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID $SLAVEPID $SLURPPID exit $RC @@ -152,7 +156,7 @@ echo "Using ldapsearch to read all the entries from the slave..." $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $SLAVEPORT \ 'objectclass=*' > $SLAVEOUT 2>&1 -if [ $RC != 0 ]; then +if test $RC != 0 ; then echo "ldapsearch failed!" kill -HUP $PID $SLAVEPID $SLURPPID exit $RC @@ -160,9 +164,18 @@ fi kill -HUP $PID $SLAVEPID $SLURPPID +SEARCHOUT=$MASTEROUT +LDIF=$SLAVEOUT + +echo "Filtering ldapsearch results..." +. $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT + echo "Comparing retrieved entries from master and slave..." -cmp $MASTEROUT $SLAVEOUT -if [ $? != 0 ]; then +cmp $SEARCHFLT $LDIFFLT + +if test $? != 0 ; then echo "test failed - master and slave databases differ" exit 1 fi