]> git.sur5r.net Git - openldap/commitdiff
Properly search for cn=monitor (to detect running slapd)
authorKurt Zeilenga <kurt@openldap.org>
Mon, 12 Jul 1999 20:55:28 +0000 (20:55 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 12 Jul 1999 20:55:28 +0000 (20:55 +0000)
tests/scripts/defines.sh
tests/scripts/test002-populate
tests/scripts/test006-acls
tests/scripts/test007-replication

index 6d8bf2f3914ee96be39d585f33f1b456c70307f4..c45657138db67aad0908a1c17270771e74ea7d58 100755 (executable)
@@ -1,33 +1,69 @@
-LDIF2LDBM=../servers/slapd/tools/ldif2ldbm
+
+DATADIR=$SRCDIR/data
+PROGDIR=./progs
+
+if test "$BACKEND" = "bdb2" ; then
+       LDIF2LDBM=../servers/slapd/tools/ldif2ldbm-bdb2
+       CONF=$DATADIR/slapd-bdb2-master.conf
+       ACLCONF=$DATADIR/slapd-bdb2-acl.conf
+       MASTERCONF=$DATADIR/slapd-bdb2-repl-master.conf
+       SLAVECONF=$DATADIR/slapd-bdb2-repl-slave.conf
+       TIMING="-t"
+else
+       LDIF2LDBM=../servers/slapd/tools/ldif2ldbm
+       CONF=$DATADIR/slapd-master.conf
+       ACLCONF=$DATADIR/slapd-acl.conf
+       MASTERCONF=$DATADIR/slapd-repl-master.conf
+       SLAVECONF=$DATADIR/slapd-repl-slave.conf
+fi
+
+if test "$LDAP_PROTO" ; then
+       PROTO="-P $LDAP_PROTO"
+fi
+
+PASSWDCONF=$DATADIR/slapd-passwd.conf
+
+CLIENTDIR=../clients/tools
+#CLIENTDIR=/usr/local/bin
+
 SLAPD=../servers/slapd/slapd
 SLURPD=../servers/slurpd/slurpd
-LDAPSEARCH=../clients/tools/ldapsearch
-LDAPMODIFY=../clients/tools/ldapmodify
-LDAPADD=../clients/tools/ldapadd
+LDAPSEARCH="$CLIENTDIR/ldapsearch $PROTO"
+LDAPMODIFY="$CLIENTDIR/ldapmodify $PROTO"
+LDAPADD="$CLIENTDIR/ldapadd $PROTO"
+LDAPMODRDN="$CLIENTDIR/ldapmodrdn $PROTO"
+SLAPDTESTER=$PROGDIR/slapd-tester
+LVL=${SLAPD_DEBUG-5}
+ADDR=127.0.0.1
 PORT=9009
 SLAVEPORT=9010
 DBDIR=./test-db
 REPLDIR=./test-repl
-CONF=./data/slapd-master.conf
-ACLCONF=./data/slapd-acl.conf
-MASTERCONF=./data/slapd-repl-master.conf
-SLAVECONF=./data/slapd-repl-slave.conf
-LDIF=./data/test.ldif
-LDIFORDERED=./data/test-ordered.ldif
+LDIF=$DATADIR/test.ldif
+LDIFORDERED=$DATADIR/test-ordered.ldif
+MONITOR="cn=monitor"
 BASEDN="o=University of Michigan, c=US"
 MANAGERDN="cn=Manager, o=University of Michigan, c=US"
 PASSWD=secret
 BABSDN="cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US"
 BJORNSDN="cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US"
 JAJDN="cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US"
+MASTERLOG=$DBDIR/master.log
+SLAVELOG=$DBDIR/slave.log
+SLURPLOG=$DBDIR/slurp.log
 SEARCHOUT=$DBDIR/ldapsearch.out
+SEARCHFLT=$DBDIR/ldapsearch.flt
+LDIFFLT=$DBDIR/ldif.flt
 MASTEROUT=$DBDIR/master.out
 SLAVEOUT=$DBDIR/slave.out
 TESTOUT=$DBDIR/ldapsearch.out
-SEARCHOUTMASTER=./data/search.out.master
-MODIFYOUTMASTER=./data/modify.out.master
-ADDDELOUTMASTER=./data/adddel.out.master
-MODRDNOUTMASTER=./data/modrdn.out.master
-ACLOUTMASTER=./data/acl.out.master
-REPLOUTMASTER=./data/repl.out.master
-MODSRCHFILTERS=./data/modify.search.filters
+SEARCHOUTMASTER=$DATADIR/search.out.master
+MODIFYOUTMASTER=$DATADIR/modify.out.master
+ADDDELOUTMASTER=$DATADIR/adddel.out.master
+MODRDNOUTMASTER0=$DATADIR/modrdn.out.master.0
+MODRDNOUTMASTER1=$DATADIR/modrdn.out.master.1
+MODRDNOUTMASTER2=$DATADIR/modrdn.out.master.2
+MODRDNOUTMASTER3=$DATADIR/modrdn.out.master.3
+ACLOUTMASTER=$DATADIR/acl.out.master
+REPLOUTMASTER=$DATADIR/repl.out.master
+MODSRCHFILTERS=$DATADIR/modify.search.filters
index c04d1f5f651563490d48c84af5991a70b06ebccb..cdb949ff152ae6ee20888aab4947fa6b8c7932fc 100755 (executable)
@@ -1,52 +1,65 @@
-#!/bin/sh
+#! /bin/sh
 
-. scripts/defines.sh
+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
 
 echo "Cleaning up in $DBDIR..."
 
-rm -f $DBDIR/*
+rm -f $DBDIR/[!C]*
 
 echo "Starting slapd on TCP/IP port $PORT..."
-$SLAPD -f $CONF -p $PORT -d 1 > /dev/null 2>&1 &
+$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
 PID=$!
 
 echo "Using ldapsearch to check that slapd is running..."
 for i in 0 1 2 3 4 5; do
-       $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
-               'cn=Monitor' > /dev/null 2>&1
+       $LDAPSEARCH -L -b "$MONITOR" -h localhost -p $PORT \
+               'objectclass=*' > /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
 
-echo "Using ldapmodify to populate the database..."
-$LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
+echo "Using ldapadd to populate the database..."
+$LDAPADD -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
        $LDIFORDERED > /dev/null 2>&1
 RC=$?
-if [ $RC != 0 ]; then
-       echo "ldapmodify failed!"
+if test $RC != 0 ; then
+       echo "ldapadd failed!"
        kill -HUP $PID
        exit $RC
 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
 
-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
index ec1c964d108e4596e956580b8ecd5c5e16fb1bfb..e1aecc8ca924ba681fc78f7c2e2a137c45cd6121 100755 (executable)
@@ -1,35 +1,45 @@
-#!/bin/sh
+#! /bin/sh
 
-. scripts/defines.sh
+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
 
 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
 
 echo "Starting slapd on TCP/IP port $PORT..."
-$SLAPD -f $ACLCONF -p $PORT -d 1 > /dev/null 2>&1 &
+$SLAPD -f $ACLCONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
 PID=$!
 
 echo "Testing slapd access control..."
 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
+       $LDAPSEARCH -L -b "$MONITOR" -h localhost -p $PORT \
+               'objectclass=*' > /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
@@ -96,18 +106,24 @@ EOMODS4
 
 echo "Using ldapsearch to retrieve all the entries..."
 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
-           'objectClass=*' | egrep -iv '^modifytimestamp|^modifiersname' \
-           >> $SEARCHOUT 2>&1
+           '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
index c0f49136c5c7e5413ed7df90d740ddf0ef4ffbf9..2f3c934139b03109540e5012567d4fc0ea7aa577 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 
 #
 # Test replication:
 # - retrieve database over ldap and compare against expected results
 #
 
-. scripts/defines.sh
+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."
+       exit 0
+fi
 
 echo "Cleaning up in $DBDIR..."
-rm -f $DBDIR/*
+rm -f $DBDIR/[!C]*
 echo "Cleaning up in $REPLDIR..."
-rm -f $REPLDIR/*
+rm -f $REPLDIR/[!C]*
 
 echo "Starting master slapd on TCP/IP port $PORT..."
-$SLAPD -f $MASTERCONF -p $PORT -d 1 > /dev/null 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 1 > /dev/null 2>&1 &
+$SLAPD -f $SLAVECONF -p $SLAVEPORT -d $LVL $TIMING > $SLAVELOG 2>&1 &
 SLAVEPID=$!
 
 echo "Using ldapsearch to check that master slapd is running..."
 for i in 0 1 2 3 4 5; do
-       $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $PORT \
-               'cn=Monitor' > /dev/null 2>&1
+       $LDAPSEARCH -L -b "$MONITOR" -h localhost -p $PORT \
+               'objectclass=*' > /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
@@ -38,25 +54,25 @@ done
 
 echo "Using ldapsearch to check that slave slapd is running..."
 for i in 0 1 2 3 4 5; do
-       $LDAPSEARCH -L -b "$BASEDN" -h localhost -p $SLAVEPORT \
-               'cn=Monitor' > /dev/null 2>&1
+       $LDAPSEARCH -L -b "$MONITOR" -h localhost -p $SLAVEPORT \
+               'objectclass=*' > /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
 
 echo "Starting slurpd..."
-$SLURPD -f $MASTERCONF -d 4 -t $REPLDIR > /dev/null 2>&1 &
+$SLURPD -f $MASTERCONF -d 4 -t $REPLDIR > $SLURPLOG 2>&1 &
 SLURPPID=$!
 
-echo "Using ldapmodify to populate the database..."
-$LDAPMODIFY -a -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
+echo "Using ldapadd to populate the database..."
+$LDAPADD -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD < \
        $LDIFORDERED > /dev/null 2>&1
 RC=$?
-if [ $RC != 0 ]; then
-       echo "ldapmodify failed!"
+if test $RC != 0 ; then
+       echo "ldapadd failed!"
        kill -HUP $PID $SLAVEPID $SLURPPID
        exit $RC
 fi
@@ -123,14 +139,14 @@ changetype: delete
 
 EOMODS
 
-echo "Waiting 10 seconds for slurpd to send changes..."
-sleep 10
+echo "Waiting 15 seconds for slurpd to send changes..."
+sleep 15
 
 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
@@ -140,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
@@ -148,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