From 11534f4ceeff130b03127411c0d6aa738b71e7c1 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 24 Oct 2003 03:35:20 +0000 Subject: [PATCH] Add/update server startup scripts --- tests/data/slapd2.conf | 31 +++++++++++++++++++ tests/run.in | 4 +-- tests/scripts/defines.sh | 5 +-- tests/scripts/{start-master => start-server} | 29 ++++------------- ...{start-master-nolog => start-server-nolog} | 29 ++++------------- tests/scripts/start-server2 | 30 ++++++++++++++++++ tests/scripts/start-server2-nolog | 30 ++++++++++++++++++ tests/scripts/stripattr.sh | 5 --- 8 files changed, 106 insertions(+), 57 deletions(-) create mode 100644 tests/data/slapd2.conf rename tests/scripts/{start-master => start-server} (64%) rename tests/scripts/{start-master-nolog => start-server-nolog} (64%) create mode 100755 tests/scripts/start-server2 create mode 100755 tests/scripts/start-server2-nolog delete mode 100755 tests/scripts/stripattr.sh diff --git a/tests/data/slapd2.conf b/tests/data/slapd2.conf new file mode 100644 index 0000000000..1f4c1bbd93 --- /dev/null +++ b/tests/data/slapd2.conf @@ -0,0 +1,31 @@ +# $OpenLDAP$ +# +# stand-alone slapd config -- for testing +# with indexing +# +ucdata-path ./ucdata +include ./schema/core.schema +include ./schema/cosine.schema +include ./schema/inetorgperson.schema +include ./schema/openldap.schema +include ./schema/nis.schema +# +pidfile ./testrun/slapd.2.pid +argsfile ./testrun/slapd.2.args + +modulepath ../servers/slapd/back-@BACKEND@/ +@MODULELOAD@ + + +####################################################################### +# database definitions +####################################################################### + +database @BACKEND@ +suffix "o=University of Michigan,c=US" +directory ./testrun/db.2.a +rootdn "cn=Manager,o=University of Michigan,c=US" +rootpw secret +index objectClass eq +index cn,sn,uid pres,eq,sub + diff --git a/tests/run.in b/tests/run.in index 8bceaded12..bef3bcfbfd 100644 --- a/tests/run.in +++ b/tests/run.in @@ -37,7 +37,7 @@ fi CLEAN=no WAIT=0 KILLSERVERS=yes -PRESERVE=no +PRESERVE=${PRESERVE-no} USERDATA=no while test $# -gt 0 ; do @@ -114,7 +114,7 @@ if test -d testrun ; then if test $PRESERVE = no ; then echo "Cleaning up test run directory leftover from previous run." /bin/rm -rf testrun - else + elif test $PRESERVE = yes ; then echo "Cleaning up only database directories leftover from previous run." /bin/rm -rf testrun/db.* fi diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index 34cead8527..75e461340b 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -19,11 +19,8 @@ DBDIR4=$TESTDIR/db.4.a DBDIR5=$TESTDIR/db.5.a DBDIR6=$TESTDIR/db.6.a -DBDIR=./test-db -CACHEDIR=./test-db2 -REPLDIR=./test-repl - CONF=$DATADIR/slapd.conf +CONFTWO=$DATADIR/slapd2.conf MCONF=$DATADIR/slapd-master.conf PWCONF=$DATADIR/slapd-pw.conf ACLCONF=$DATADIR/slapd-acl.conf diff --git a/tests/scripts/start-master b/tests/scripts/start-server similarity index 64% rename from tests/scripts/start-master rename to tests/scripts/start-server index bbad878074..f73096d574 100755 --- a/tests/scripts/start-master +++ b/tests/scripts/start-server @@ -1,23 +1,10 @@ #! /bin/sh # $OpenLDAP$ -SRCDIR="." -if test $# -ge 1 ; then - SRCDIR=$1; shift -fi -BACKEND=bdb -if test $# -ge 1 ; then - BACKEND=$1; shift -fi - echo "running defines.sh" . $SRCDIR/scripts/defines.sh -echo "Datadir is $DATADIR" - -echo "Cleaning up in $DBDIR..." - -rm -f $DBDIR/[!C]* +mkdir -p $TESTDIR $DBDIR1 echo "Running slapadd to build slapd database..." . $CONFFILTER $BACKEND < $CONF > $ADDCONF @@ -28,14 +15,14 @@ if test $RC != 0 ; then exit $RC fi -echo "Starting slapd on TCP/IP port $PORT..." -. $CONFFILTER $BACKEND < $CONF > $DBCONF -$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 & +echo "Starting slapd on TCP/IP port $PORT1..." +. $CONFFILTER $BACKEND < $CONF > $CONF1 +$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 & PID=$! echo "Using ldapsearch to retrieve all the entries..." for i in 0 1 2 3 4 5; do - $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT > $SEARCHOUT 2>&1 + $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1 RC=$? if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." @@ -43,8 +30,6 @@ for i in 0 1 2 3 4 5; do fi done -# kill -HUP $PID - if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" exit $RC @@ -62,7 +47,5 @@ if test $? != 0 ; then exit 1 fi -echo ">>>>> Master (pid=$PID) started" - - +echo ">>>>> Server1 (pid=$PID) started" exit 0 diff --git a/tests/scripts/start-master-nolog b/tests/scripts/start-server-nolog similarity index 64% rename from tests/scripts/start-master-nolog rename to tests/scripts/start-server-nolog index 0dedcb752a..ff049f3581 100755 --- a/tests/scripts/start-master-nolog +++ b/tests/scripts/start-server-nolog @@ -1,23 +1,10 @@ #! /bin/sh # $OpenLDAP$ -SRCDIR="." -if test $# -ge 1 ; then - SRCDIR=$1; shift -fi -BACKEND=bdb -if test $# -ge 1 ; then - BACKEND=$1; shift -fi - echo "running defines.sh" . $SRCDIR/scripts/defines.sh -echo "Datadir is $DATADIR" - -echo "Cleaning up in $DBDIR..." - -rm -f $DBDIR/[!C]* +mkdir -p $TESTDIR $DBDIR1 echo "Running slapadd to build slapd database..." . $CONFFILTER $BACKEND < $CONF > $ADDCONF @@ -28,14 +15,14 @@ if test $RC != 0 ; then exit $RC fi -echo "Starting slapd on TCP/IP port $PORT..." -. $CONFFILTER $BACKEND < $CONF > $DBCONF -$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING >> /dev/null 2>&1 & +echo "Starting slapd on TCP/IP port $PORT1..." +. $CONFFILTER $BACKEND < $CONF > $CONF1 +$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> /dev/null 2>&1 & PID=$! echo "Using ldapsearch to retrieve all the entries..." for i in 0 1 2 3 4 5; do - $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT > $SEARCHOUT 2>&1 + $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1 RC=$? if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." @@ -43,8 +30,6 @@ for i in 0 1 2 3 4 5; do fi done -# kill -HUP $PID - if test $RC != 0 ; then echo "ldapsearch failed ($RC)!" exit $RC @@ -62,7 +47,5 @@ if test $? != 0 ; then exit 1 fi -echo ">>>>> Master (pid=$PID) started" - - +echo ">>>>> Server1 (pid=$PID) started" exit 0 diff --git a/tests/scripts/start-server2 b/tests/scripts/start-server2 new file mode 100755 index 0000000000..1c8b195598 --- /dev/null +++ b/tests/scripts/start-server2 @@ -0,0 +1,30 @@ +#! /bin/sh +# $OpenLDAP$ + +echo "running defines.sh" +. $SRCDIR/scripts/defines.sh + +mkdir -p $TESTDIR $DBDIR2 + +echo "Starting slapd on TCP/IP port $PORT2..." +. $CONFFILTER $BACKEND < $CONFTWO > $CONF2 +$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 & +PID=$! + +echo "Using ldapsearch to retrieve all the entries..." +for i in 0 1 2 3 4 5; do + $LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 > $SERVER2OUT 2>&1 + RC=$? + if test $RC = 1 ; then + echo "Waiting 5 seconds for slapd to start..." + sleep 5 + fi +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + exit $RC +fi + +echo ">>>>> Server2 (pid=$PID) started" +exit 0 diff --git a/tests/scripts/start-server2-nolog b/tests/scripts/start-server2-nolog new file mode 100755 index 0000000000..29a06e0ee8 --- /dev/null +++ b/tests/scripts/start-server2-nolog @@ -0,0 +1,30 @@ +#! /bin/sh +# $OpenLDAP$ + +echo "running defines.sh" +. $SRCDIR/scripts/defines.sh + +mkdir -p $TESTDIR $DBDIR2 + +echo "Starting slapd on TCP/IP port $PORT2..." +. $CONFFILTER $BACKEND < $CONFTWO > $CONF2 +$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > /dev/null 2>&1 & +PID=$! + +echo "Using ldapsearch to retrieve all the entries..." +for i in 0 1 2 3 4 5; do + $LDAPSEARCH -S "" -b "" -s base -h $LOCALHOST -p $PORT2 > $SERVER2OUT 2>&1 + RC=$? + if test $RC = 1 ; then + echo "Waiting 5 seconds for slapd to start..." + sleep 5 + fi +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + exit $RC +fi + +echo ">>>>> Server2 (pid=$PID) started" +exit 0 diff --git a/tests/scripts/stripattr.sh b/tests/scripts/stripattr.sh deleted file mode 100755 index 5645e029b3..0000000000 --- a/tests/scripts/stripattr.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -# -# Strip attribute from LDIF -# -awk '/^'$1'/ {getline; while (substr($0,1,1) == " ") getline;} /.*/ {print $0}' -- 2.39.5