1999-04-21 01:59:01 -04:00
|
|
|
#! /bin/sh
|
1999-02-15 05:49:20 -05:00
|
|
|
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $# -eq 0 ; then
|
1999-02-15 05:49:20 -05:00
|
|
|
SRCDIR="."
|
|
|
|
|
else
|
|
|
|
|
SRCDIR=$1; shift
|
|
|
|
|
fi
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $# -eq 1 ; then
|
1999-04-10 00:42:33 -04:00
|
|
|
BACKEND=$1; shift
|
1999-02-15 05:49:20 -05:00
|
|
|
fi
|
|
|
|
|
|
1999-04-10 00:42:33 -04:00
|
|
|
echo "running defines.sh $SRCDIR $BACKEND"
|
1999-02-15 05:49:20 -05:00
|
|
|
|
1999-04-07 22:18:54 -04:00
|
|
|
. $SRCDIR/scripts/defines.sh
|
1999-02-15 05:49:20 -05:00
|
|
|
|
|
|
|
|
echo "Datadir is $DATADIR"
|
|
|
|
|
|
|
|
|
|
echo "Cleaning up in $DBDIR..."
|
|
|
|
|
|
1999-07-14 19:13:34 -04:00
|
|
|
rm -f $DBDIR/[!C]*
|
1999-02-15 05:49:20 -05:00
|
|
|
|
|
|
|
|
echo "Running ldif2ldbm to build slapd database..."
|
1999-08-17 15:00:59 -04:00
|
|
|
$LDIF2LDBM -f $CONF -l $LDIF
|
1999-02-15 05:49:20 -05:00
|
|
|
RC=$?
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $RC != 0 ; then
|
1999-02-15 05:49:20 -05:00
|
|
|
echo "ldif2ldbm failed!"
|
|
|
|
|
exit $RC
|
|
|
|
|
fi
|
|
|
|
|
|
1999-02-18 10:33:15 -05:00
|
|
|
echo "Waiting 5 seconds for ldif2ldbm to build slapd database..."
|
|
|
|
|
sleep 5
|
|
|
|
|
|
1999-02-15 05:49:20 -05:00
|
|
|
echo "Starting slapd on TCP/IP port $PORT..."
|
|
|
|
|
$SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
|
|
|
|
|
PID=$!
|
|
|
|
|
|
1999-07-15 22:45:46 -04:00
|
|
|
echo "Using ldapsearch to check that slapd is running..."
|
|
|
|
|
for i in 0 1 2 3 4 5; do
|
1999-07-30 19:00:02 -04:00
|
|
|
$LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
|
1999-07-15 22:45:46 -04:00
|
|
|
'objectclass=*' > /dev/null 2>&1
|
|
|
|
|
RC=$?
|
|
|
|
|
if test $RC = 1 ; then
|
|
|
|
|
echo "Waiting 5 seconds for slapd to start..."
|
|
|
|
|
sleep 5
|
|
|
|
|
fi
|
|
|
|
|
done
|
1999-02-15 05:49:20 -05:00
|
|
|
|
|
|
|
|
echo "Using tester for concurrent server access..."
|
1999-02-22 06:28:01 -05:00
|
|
|
$SLAPDTESTER -b "$BASEDN" -P "$PROGDIR" -d "$DATADIR" -h localhost -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50
|
1999-02-15 05:49:20 -05:00
|
|
|
RC=$?
|
|
|
|
|
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $RC != 0 ; then
|
1999-02-15 05:49:20 -05:00
|
|
|
echo "slapd-tester failed!"
|
|
|
|
|
exit $RC
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Using ldapsearch to retrieve all the entries..."
|
1999-07-30 19:00:02 -04:00
|
|
|
$LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
|
1999-02-15 05:49:20 -05:00
|
|
|
'objectClass=*' > $SEARCHOUT 2>&1
|
|
|
|
|
RC=$?
|
|
|
|
|
|
|
|
|
|
kill -HUP $PID
|
|
|
|
|
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $RC != 0 ; then
|
1999-02-15 05:49:20 -05:00
|
|
|
echo "ldapsearch failed!"
|
|
|
|
|
exit $RC
|
|
|
|
|
fi
|
|
|
|
|
|
1999-05-21 12:50:51 -04:00
|
|
|
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
|
|
|
|
|
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $? != 0 ; then
|
1999-02-15 05:49:20 -05:00
|
|
|
echo "comparison failed - database was not created correctly"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo ">>>>> Test succeeded"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit 0
|