From: Howard Chu Date: Fri, 9 Mar 2007 09:34:41 +0000 (+0000) Subject: Fixes (mostly from Buchan Milne) to make all generated files relative X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~628 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=94a11462a153f2715e147eb6d46ac52cae39ca4a;p=openldap Fixes (mostly from Buchan Milne) to make all generated files relative to $TESTDIR --- diff --git a/tests/data/slapd-config-undo.conf b/tests/data/slapd-config-undo.conf index d3013c3328..d4ff1eaa0a 100644 --- a/tests/data/slapd-config-undo.conf +++ b/tests/data/slapd-config-undo.conf @@ -20,4 +20,4 @@ rootpw secret #monitor#database monitor database config -include "configpw.conf" +include @TESTDIR@/configpw.conf diff --git a/tests/data/slapd-dynamic.ldif b/tests/data/slapd-dynamic.ldif index fe86edcac6..166e58f912 100644 --- a/tests/data/slapd-dynamic.ldif +++ b/tests/data/slapd-dynamic.ldif @@ -5,4 +5,4 @@ cn: config dn: olcDatabase={0}config,cn=config objectClass: olcDatabaseConfig olcDatabase: {0}config -olcRootPW:< file:configpw +olcRootPW:< file://@TESTDIR@/configpw diff --git a/tests/data/slapd-translucent-local.conf b/tests/data/slapd-translucent-local.conf index df59b2313e..57737513bf 100644 --- a/tests/data/slapd-translucent-local.conf +++ b/tests/data/slapd-translucent-local.conf @@ -63,4 +63,4 @@ lastmod off acl-bind binddn="uid=binder,o=translucent" credentials="bindtest" database config -include "configpw.conf" +include @TESTDIR@/configpw.conf diff --git a/tests/data/slapd-valsort.conf b/tests/data/slapd-valsort.conf index 468e959b56..372a82a256 100644 --- a/tests/data/slapd-valsort.conf +++ b/tests/data/slapd-valsort.conf @@ -52,6 +52,6 @@ valsort-attr ou ou=users,o=valsort weighted valsort-attr employeeType ou=users,o=valsort weighted alpha-ascend database config -include configpw.conf +include @TESTDIR@/configpw.conf #monitor#database monitor diff --git a/tests/run.in b/tests/run.in index a8bcaa1cac..f5c11b14ec 100644 --- a/tests/run.in +++ b/tests/run.in @@ -176,22 +176,19 @@ if test -d ${TESTDIR} ; then /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=$? diff --git a/tests/scripts/all b/tests/scripts/all index e05bba09ab..452c611f98 100755 --- a/tests/scripts/all +++ b/tests/scripts/all @@ -13,7 +13,7 @@ ## top-level directory of the distribution or, alternatively, at ## . -SHTOOL="$SRCDIR/../build/shtool" + . scripts/defines.sh TB=`$SHTOOL echo -e "%B"` TN=`$SHTOOL echo -e "%b"` SLEEPTIME=10 @@ -23,9 +23,9 @@ echo ">>>>> Executing all LDAP tests for $BACKEND" 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} ..." diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index 8f4e7ad121..e1c2902252 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -15,6 +15,8 @@ umask 077 +TESTWD=`pwd` + # backends MONITORDB=${AC_monitor-no} BACKLDAP=${AC_ldap-ldapno} @@ -48,7 +50,7 @@ THREADS=${AC_THREADS-threadsno} # 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 @@ -135,6 +137,7 @@ CONF4=$TESTDIR/slapd.4.conf 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 @@ -145,7 +148,7 @@ LOG6=$TESTDIR/slapd.6.log SLAPADDLOG1=$TESTDIR/slapadd.1.log SLURPLOG=$TESTDIR/slurp.log -CONFIGPWF=./configpw +CONFIGPWF=$TESTDIR/configpw # args TOOLARGS="-x $LDAP_TOOLARGS" @@ -155,10 +158,10 @@ TOOLPROTO="-P 3" 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... @@ -166,8 +169,8 @@ DIFF="diff -i" 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" @@ -325,6 +328,7 @@ SUBTREERENAMEOUT=$DATADIR/subtree-rename.out 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 diff --git a/tests/scripts/test034-translucent b/tests/scripts/test034-translucent index d657b57c39..79eb72425d 100755 --- a/tests/scripts/test034-translucent +++ b/tests/scripts/test034-translucent @@ -33,6 +33,9 @@ fi # 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 diff --git a/tests/scripts/test042-valsort b/tests/scripts/test042-valsort index 895a9d9507..3289e3336c 100755 --- a/tests/scripts/test042-valsort +++ b/tests/scripts/test042-valsort @@ -23,6 +23,9 @@ fi 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 diff --git a/tests/scripts/test049-sync-config b/tests/scripts/test049-sync-config index 80406de47f..759fcc58da 100755 --- a/tests/scripts/test049-sync-config +++ b/tests/scripts/test049-sync-config @@ -27,11 +27,11 @@ DBPRO=$PRODIR/db 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 @@ -43,16 +43,17 @@ mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON # 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 @@ -90,7 +91,7 @@ EOF exit $RC fi fi -CONFIGPW=`cat $CONFIGPWF` +read CONFIGPW < $CONFIGPWF $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <> $TESTOUT 2>&1 dn: olcDatabase={0}config,cn=config changetype: modify @@ -116,16 +117,16 @@ if test $RC != 0 ; then 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 diff --git a/tests/scripts/test050-syncrepl-multimaster b/tests/scripts/test050-syncrepl-multimaster index 1540244a25..3f75c4e538 100755 --- a/tests/scripts/test050-syncrepl-multimaster +++ b/tests/scripts/test050-syncrepl-multimaster @@ -27,11 +27,11 @@ DBPRO=$PRODIR/db 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 @@ -52,7 +52,7 @@ olcServerID: 2 dn: olcDatabase={0}config,cn=config objectClass: olcDatabaseConfig olcDatabase: {0}config -olcRootPW:< file:configpw +olcRootPW:< file://$CONFIGPWF EOF $SLAPADD -F $CFPRO -n 0 < ../$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 @@ -121,7 +121,7 @@ fi # 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 <> $TESTOUT 2>&1 dn: cn=config changetype: modify @@ -157,14 +157,14 @@ fi 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 @@ -379,15 +379,15 @@ test $KILLSERVERS != no && wait 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 \ @@ -408,15 +408,15 @@ fi #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 diff --git a/tests/scripts/test051-config-undo b/tests/scripts/test051-config-undo index 4a41da1def..273406b7d1 100755 --- a/tests/scripts/test051-config-undo +++ b/tests/scripts/test051-config-undo @@ -18,6 +18,9 @@ echo "running defines.sh" 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 < $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