1999-04-21 01:59:01 -04:00
|
|
|
#! /bin/sh
|
1999-09-01 20:52:43 -04:00
|
|
|
# $OpenLDAP$
|
2003-11-28 15:00:23 -05:00
|
|
|
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
|
##
|
2020-01-09 11:50:21 -05:00
|
|
|
## Copyright 1998-2020 The OpenLDAP Foundation.
|
2003-11-28 15:00:23 -05:00
|
|
|
## All rights reserved.
|
|
|
|
|
##
|
|
|
|
|
## Redistribution and use in source and binary forms, with or without
|
|
|
|
|
## modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
|
## Public License.
|
|
|
|
|
##
|
|
|
|
|
## A copy of this license is available in the file LICENSE in the
|
|
|
|
|
## top-level directory of the distribution or, alternatively, at
|
|
|
|
|
## <http://www.OpenLDAP.org/license.html>.
|
1999-02-15 05:49:20 -05:00
|
|
|
|
2000-10-01 18:46:52 -04:00
|
|
|
echo "running defines.sh"
|
1999-04-07 22:18:54 -04:00
|
|
|
. $SRCDIR/scripts/defines.sh
|
1999-02-15 05:49:20 -05:00
|
|
|
|
2008-10-05 17:29:16 -04:00
|
|
|
if test x$TESTLOOPS = x ; then
|
|
|
|
|
TESTLOOPS=50
|
2008-07-19 07:54:01 -04:00
|
|
|
fi
|
|
|
|
|
|
2003-10-22 01:14:08 -04:00
|
|
|
mkdir -p $TESTDIR $DBDIR1
|
1999-02-15 05:49:20 -05:00
|
|
|
|
1999-08-22 13:10:23 -04:00
|
|
|
echo "Running slapadd to build slapd database..."
|
2003-10-22 01:14:08 -04:00
|
|
|
. $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
|
2005-05-27 16:47:47 -04:00
|
|
|
$SLAPADD -f $CONF1 -l $LDIFORDERED -d -1 2> $SLAPADDLOG1
|
1999-02-15 05:49:20 -05:00
|
|
|
RC=$?
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $RC != 0 ; then
|
2000-07-04 18:11:12 -04:00
|
|
|
echo "slapadd failed ($RC)!"
|
1999-02-15 05:49:20 -05:00
|
|
|
exit $RC
|
|
|
|
|
fi
|
|
|
|
|
|
2003-10-22 01:14:08 -04:00
|
|
|
echo "Starting slapd on TCP/IP port $PORT1..."
|
|
|
|
|
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
|
1999-02-15 05:49:20 -05:00
|
|
|
PID=$!
|
2001-09-22 01:34:22 -04:00
|
|
|
if test $WAIT != 0 ; then
|
|
|
|
|
echo PID $PID
|
|
|
|
|
read foo
|
|
|
|
|
fi
|
2003-10-22 01:14:08 -04:00
|
|
|
KILLPIDS="$PID"
|
1999-02-15 05:49:20 -05:00
|
|
|
|
2005-09-30 03:32:49 -04:00
|
|
|
sleep 1
|
|
|
|
|
|
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
|
2003-10-22 01:14:08 -04:00
|
|
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
1999-07-15 22:45:46 -04:00
|
|
|
'objectclass=*' > /dev/null 2>&1
|
|
|
|
|
RC=$?
|
2002-09-01 07:39:08 -04:00
|
|
|
if test $RC = 0 ; then
|
|
|
|
|
break
|
1999-07-15 22:45:46 -04:00
|
|
|
fi
|
2002-09-01 07:39:08 -04:00
|
|
|
echo "Waiting 5 seconds for slapd to start..."
|
|
|
|
|
sleep 5
|
1999-07-15 22:45:46 -04:00
|
|
|
done
|
1999-02-15 05:49:20 -05:00
|
|
|
|
2008-07-19 10:28:41 -04:00
|
|
|
# fix test data to include back-monitor, if available
|
|
|
|
|
# NOTE: copies do_* files from $DATADIR to $TESTDIR
|
|
|
|
|
$MONITORDATA "$MONITORDB" "$DATADIR" "$TESTDIR"
|
|
|
|
|
|
1999-02-15 05:49:20 -05:00
|
|
|
echo "Using tester for concurrent server access..."
|
2016-04-29 21:30:30 -04:00
|
|
|
$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR" -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l $TESTLOOPS
|
1999-02-15 05:49:20 -05:00
|
|
|
RC=$?
|
|
|
|
|
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $RC != 0 ; then
|
2000-07-04 18:11:12 -04:00
|
|
|
echo "slapd-tester failed ($RC)!"
|
2003-10-22 01:14:08 -04:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-02-15 05:49:20 -05:00
|
|
|
exit $RC
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Using ldapsearch to retrieve all the entries..."
|
2003-10-22 01:14:08 -04:00
|
|
|
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
|
1999-02-15 05:49:20 -05:00
|
|
|
'objectClass=*' > $SEARCHOUT 2>&1
|
|
|
|
|
RC=$?
|
|
|
|
|
|
2003-10-22 01:14:08 -04:00
|
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
1999-02-15 05:49:20 -05:00
|
|
|
|
1999-04-21 01:59:01 -04:00
|
|
|
if test $RC != 0 ; then
|
2000-07-04 18:11:12 -04:00
|
|
|
echo "ldapsearch failed ($RC)!"
|
1999-02-15 05:49:20 -05:00
|
|
|
exit $RC
|
|
|
|
|
fi
|
|
|
|
|
|
1999-05-21 12:50:51 -04:00
|
|
|
echo "Filtering ldapsearch results..."
|
2009-11-29 04:10:25 -05:00
|
|
|
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
1999-05-21 12:50:51 -04:00
|
|
|
echo "Filtering original ldif used to create database..."
|
2009-11-29 04:10:25 -05:00
|
|
|
$LDIFFILTER < $LDIF > $LDIFFLT
|
1999-05-21 12:50:51 -04:00
|
|
|
echo "Comparing filter output..."
|
2000-07-19 22:23:00 -04:00
|
|
|
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
|
1999-05-21 12:50:51 -04:00
|
|
|
|
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"
|
2006-01-11 00:25:09 -05:00
|
|
|
|
|
|
|
|
test $KILLSERVERS != no && wait
|
|
|
|
|
|
1999-02-15 05:49:20 -05:00
|
|
|
exit 0
|