#monitor#database monitor
database config
-include "configpw.conf"
+include @TESTDIR@/configpw.conf
dn: olcDatabase={0}config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
-olcRootPW:< file:configpw
+olcRootPW:< file://@TESTDIR@/configpw
acl-bind binddn="uid=binder,o=translucent" credentials="bindtest"
database config
-include "configpw.conf"
+include @TESTDIR@/configpw.conf
valsort-attr employeeType ou=users,o=valsort weighted alpha-ascend
database config
-include configpw.conf
+include @TESTDIR@/configpw.conf
#monitor#database monitor
/bin/rm -rf ${TESTDIR}/db.*
fi
fi
+mkdir -p ${TESTDIR}
if test $USERDATA = yes ; then
if test ! -d userdata ; then
echo "User data directory (userdata) does not exist."
exit 1
fi
- mkdir -p ${TESTDIR}
cp -R userdata/* ${TESTDIR}
fi
# disable LDAP initialization
LDAPNOINIT=true; export LDAPNOINIT
-$SLAPPASSWD -g -n >$CONFIGPWF
-echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >configpw.conf
-
echo "Running ${SCRIPT}..."
$SCRIPT $*
RC=$?
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
-SHTOOL="$SRCDIR/../build/shtool"
+ . scripts/defines.sh
TB=`$SHTOOL echo -e "%B"`
TN=`$SHTOOL echo -e "%b"`
SLEEPTIME=10
for CMD in $SRCDIR/scripts/test*; do
# remove cruft from prior test
if test $PRESERVE = yes ; then
- /bin/rm -rf testrun/db.*
+ /bin/rm -rf $TESTDIR/db.*
else
- /bin/rm -rf testrun
+ /bin/rm -rf $TESTDIR
fi
echo ">>>>> Starting ${TB}`basename $CMD`${TN} ..."
umask 077
+TESTWD=`pwd`
+
# backends
MONITORDB=${AC_monitor-no}
BACKLDAP=${AC_ldap-ldapno}
# dirs
PROGDIR=./progs
DATADIR=${USER_DATADIR-./testdata}
-TESTDIR=${USER_TESTDIR-./testrun}
+TESTDIR=${USER_TESTDIR-$TESTWD/testrun}
SCHEMADIR=${USER_SCHEMADIR-./schema}
DBDIR1A=$TESTDIR/db.1.a
CONF5=$TESTDIR/slapd.5.conf
CONF6=$TESTDIR/slapd.6.conf
ADDCONF=$TESTDIR/slapadd.conf
+CONFLDIF=$TESTDIR/slapd-dynamic.ldif
LOG1=$TESTDIR/slapd.1.log
LOG2=$TESTDIR/slapd.2.log
SLAPADDLOG1=$TESTDIR/slapadd.1.log
SLURPLOG=$TESTDIR/slurp.log
-CONFIGPWF=./configpw
+CONFIGPWF=$TESTDIR/configpw
# args
TOOLARGS="-x $LDAP_TOOLARGS"
LDIFFILTER=$SRCDIR/scripts/acfilter.sh
CONFFILTER=$SRCDIR/scripts/conf.sh
-SLAPADD="`pwd`/../servers/slapd/slapd -Ta -d 0 $LDAP_VERBOSE"
-SLAPCAT="`pwd`/../servers/slapd/slapd -Tc -d 0 $LDAP_VERBOSE"
-SLAPINDEX="`pwd`/../servers/slapd/slapd -Ti -d 0 $LDAP_VERBOSE"
-SLAPPASSWD="`pwd`/../servers/slapd/slapd -Tpasswd"
+SLAPADD="$TESTWD/../servers/slapd/slapd -Ta -d 0 $LDAP_VERBOSE"
+SLAPCAT="$TESTWD/../servers/slapd/slapd -Tc -d 0 $LDAP_VERBOSE"
+SLAPINDEX="$TESTWD/../servers/slapd/slapd -Ti -d 0 $LDAP_VERBOSE"
+SLAPPASSWD="$TESTWD/../servers/slapd/slapd -Tpasswd"
unset DIFF_OPTIONS
# NOTE: -u/-c is not that portable...
CMP="diff -i"
BCMP="diff -iB"
CMPOUT=/dev/null
-SLAPD="`pwd`/../servers/slapd/slapd -s0"
-SLURPD="`pwd`/../servers/slurpd/slurpd"
+SLAPD="$TESTWD/../servers/slapd/slapd -s0"
+SLURPD="$TESTWD/../servers/slurpd/slurpd"
LDAPPASSWD="$CLIENTDIR/ldappasswd $TOOLARGS"
LDAPSASLSEARCH="$CLIENTDIR/ldapsearch $TOOLPROTO $LDAP_TOOLARGS -LLL"
LDAPSEARCH="$CLIENTDIR/ldapsearch $TOOLPROTO $TOOLARGS -LLL"
ACIOUT=$DATADIR/aci.out
DYNLISTOUT=$DATADIR/dynlist.out
DDSOUT=$DATADIR/dds.out
+SHTOOL="$SRCDIR/../build/shtool"
# Just in case we linked the binaries dynamically
-LD_LIBRARY_PATH=`pwd`/../libraries:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH
+LD_LIBRARY_PATH=$TESTWD/../libraries:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH
# configure backside
mkdir -p $TESTDIR $DBDIR1
+$SLAPPASSWD -g -n >$CONFIGPWF
+echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
+
. $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTREMOTECONF > $CONF1
echo "Running slapadd to build remote slapd database..."
$SLAPADD -f $CONF1 -l $LDIFTRANSLUCENTCONFIG
mkdir -p $TESTDIR $DBDIR1
+$SLAPPASSWD -g -n >$CONFIGPWF
+echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
+
echo "Running slapadd to build slapd database..."
. $CONFFILTER $BACKEND $MONITORDB < $VALSORTCONF > $CONF1
$SLAPADD -f $CONF1 -l $LDIFVALSORT
DBCON=$CONDIR/db
CFPRO=$PRODIR/slapd.d
CFCON=$CONDIR/slapd.d
-LOG1=slapd.1.log
-LOG2=slapd.2.log
mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON
+$SLAPPASSWD -g -n >$CONFIGPWF
+
#
# Test replication of dynamic config:
# - start producer
#
echo "Starting producer slapd on TCP/IP port $PORT1..."
-$SLAPADD -F $CFPRO -n 0 -l $DYNAMICCONF
+. $CONFFILTER $BACKEND $MONITORDB < $DYNAMICCONF > $CONFLDIF
+$SLAPADD -F $CFPRO -n 0 -l $CONFLDIF
cd $PRODIR
-$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING > ../$LOG1 2>&1 &
+$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
KILLPIDS="$PID"
-cd ../..
+cd $TESTWD
sleep 1
exit $RC
fi
fi
-CONFIGPW=`cat $CONFIGPWF`
+read CONFIGPW < $CONFIGPWF
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
dn: olcDatabase={0}config,cn=config
changetype: modify
fi
echo "Starting consumer slapd on TCP/IP port $PORT2..."
-$SLAPADD -F $CFCON -n 0 -l $DYNAMICCONF
+$SLAPADD -F $CFCON -n 0 -l $CONFLDIF
cd $CONDIR
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > ../$LOG2 2>&1 &
+$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
read foo
fi
KILLPIDS="$KILLPIDS $SLAVEPID"
-cd ../..
+cd $TESTWD
sleep 1
DBCON=$CONDIR/db
CFPRO=$PRODIR/slapd.d
CFCON=$CONDIR/slapd.d
-LOG1=slapd.1.log
-LOG2=slapd.2.log
mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON
+$SLAPPASSWD -g -n >$CONFIGPWF
+
#
# Test replication of dynamic config:
# - start producer
dn: olcDatabase={0}config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
-olcRootPW:< file:configpw
+olcRootPW:< file://$CONFIGPWF
EOF
$SLAPADD -F $CFPRO -n 0 <<EOF
dn: olcDatabase={0}config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
-olcRootPW:< file:configpw
+olcRootPW:< file://$CONFIGPWF
EOF
echo "Starting producer slapd on TCP/IP port $PORT1..."
cd $PRODIR
-$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING > ../$LOG1 2>&1 &
+$SLAPD -F slapd.d -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
KILLPIDS="$PID"
-cd ../..
+cd $TESTWD
sleep 1
# neither server will progress. The timeout will drop the syncrepl
# attempt and allow the modifies to complete.
#
-CONFIGPW=`cat $CONFIGPWF`
+read CONFIGPW < $CONFIGPWF
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
dn: cn=config
changetype: modify
echo "Starting consumer slapd on TCP/IP port $PORT2..."
cd $CONDIR
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > ../$LOG2 2>&1 &
+$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
read foo
fi
KILLPIDS="$KILLPIDS $SLAVEPID"
-cd ../..
+cd $TESTWD
sleep 1
echo "Restarting servers..."
echo "Starting producer slapd on TCP/IP port $PORT1..."
cd $PRODIR
-echo "======================= RESTART =======================" >> ../$LOG1
-$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> ../$LOG1 2>&1 &
+echo "======================= RESTART =======================" >> $LOG1
+$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
KILLPIDS="$PID"
-cd ../..
+cd $TESTWD
echo "Using ldapsearch to check that producer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI1 \
#exit 0
echo "Starting consumer slapd on TCP/IP port $PORT2..."
cd $CONDIR
-echo "======================= RESTART =======================" >> ../$LOG2
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> ../$LOG2 2>&1 &
+echo "======================= RESTART =======================" >> $LOG2
+$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
read foo
fi
KILLPIDS="$KILLPIDS $SLAVEPID"
-cd ../..
+cd $TESTWD
sleep 1
mkdir -p $TESTDIR $DBDIR1
+$SLAPPASSWD -g -n >$CONFIGPWF
+echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
+
echo "Running slapadd to build slapd database..."
. $CONFFILTER $BACKEND $MONITORDB < $UNDOCONF > $CONF1
$SLAPADD -f $CONF1 <<EOF
fi
echo "Starting slapd on TCP/IP port $PORT1..."
-mkdir testrun/confdir
-$SLAPD -f $CONF1 -F testrun/confdir -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+mkdir $TESTDIR/confdir
+$SLAPD -f $CONF1 -F $TESTDIR/confdir -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID