--- /dev/null
+#! /bin/sh
+egrep -iv '^modifiersname:|^modifytimestamp:|^creatorsname:|^createtimestamp'
-#!/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
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)"
+
DATADIR=$SRCDIR/data
+PROGDIR=./progs
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
+
+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
-LDAPMODRDN=../clients/tools/ldapmodrdn
-LDAPADD=../clients/tools/ldapadd
-LVL=5
+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
-CONF=$DATADIR/slapd-master.conf
-ACLCONF=$DATADIR/slapd-acl.conf
-MASTERCONF=$DATADIR/slapd-repl-master.conf
-SLAVECONF=$DATADIR/slapd-repl-slave.conf
LDIF=$DATADIR/test.ldif
LDIFORDERED=$DATADIR/test-ordered.ldif
BASEDN="o=University of Michigan, c=US"
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
-#!/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
-#!/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"
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..."
$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
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
-#!/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..."
$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
$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
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 filter output..."
cmp $SEARCHFLT $LDIFFLT
-if [ $? != 0 ]; then
+if test $? != 0 ; then
echo "comparison failed - database was not created correctly"
exit 1
fi
-#!/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..."
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..."
$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
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
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
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
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
-#!/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..."
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..."
$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
EOMODS
RC=$?
-if [ $RC != 0 ]; then
+if test $RC != 0 ; then
echo "ldapmodify failed!"
kill -HUP $PID
exit $RC
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
exit $RC
fi
-cat /dev/null > $TESTOUT_MODRDN
+cat /dev/null > $TESTOUT
+
# -r used to do remove of old rdn
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
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
-#!/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..."
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..."
$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
'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
-#!/bin/sh
+#! /bin/sh
#
# Test replication:
# - 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."
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..."
$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
$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
$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
$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
$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
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