From: Kurt Zeilenga Date: Fri, 24 Oct 2003 03:35:20 +0000 (+0000) Subject: Add/update server startup scripts X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~493 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=11534f4ceeff130b03127411c0d6aa738b71e7c1;p=openldap Add/update server startup scripts --- 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-master deleted file mode 100755 index bbad878074..0000000000 --- a/tests/scripts/start-master +++ /dev/null @@ -1,68 +0,0 @@ -#! /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]* - -echo "Running slapadd to build slapd database..." -. $CONFFILTER $BACKEND < $CONF > $ADDCONF -$SLAPADD -f $ADDCONF -l $LDIFORDERED -RC=$? -if test $RC != 0 ; then - echo "slapadd failed ($RC)!" - 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 & -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 - RC=$? - if test $RC = 1 ; then - echo "Waiting 5 seconds for slapd to start..." - sleep 5 - fi -done - -# kill -HUP $PID - -if test $RC != 0 ; then - echo "ldapsearch failed ($RC)!" - exit $RC -fi - -echo "Filtering ldapsearch results..." -. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT -echo "Filtering original ldif used to create database..." -. $LDIFFILTER < $LDIF > $LDIFFLT -echo "Comparing filter output..." -$CMP $SEARCHFLT $LDIFFLT > $CMPOUT - -if test $? != 0 ; then - echo "comparison failed - database was not created correctly" - exit 1 -fi - -echo ">>>>> Master (pid=$PID) started" - - -exit 0 diff --git a/tests/scripts/start-master-nolog b/tests/scripts/start-master-nolog deleted file mode 100755 index 0dedcb752a..0000000000 --- a/tests/scripts/start-master-nolog +++ /dev/null @@ -1,68 +0,0 @@ -#! /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]* - -echo "Running slapadd to build slapd database..." -. $CONFFILTER $BACKEND < $CONF > $ADDCONF -$SLAPADD -f $ADDCONF -l $LDIFORDERED -RC=$? -if test $RC != 0 ; then - echo "slapadd failed ($RC)!" - 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 & -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 - RC=$? - if test $RC = 1 ; then - echo "Waiting 5 seconds for slapd to start..." - sleep 5 - fi -done - -# kill -HUP $PID - -if test $RC != 0 ; then - echo "ldapsearch failed ($RC)!" - exit $RC -fi - -echo "Filtering ldapsearch results..." -. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT -echo "Filtering original ldif used to create database..." -. $LDIFFILTER < $LDIF > $LDIFFLT -echo "Comparing filter output..." -$CMP $SEARCHFLT $LDIFFLT > $CMPOUT - -if test $? != 0 ; then - echo "comparison failed - database was not created correctly" - exit 1 -fi - -echo ">>>>> Master (pid=$PID) started" - - -exit 0 diff --git a/tests/scripts/start-server b/tests/scripts/start-server new file mode 100755 index 0000000000..f73096d574 --- /dev/null +++ b/tests/scripts/start-server @@ -0,0 +1,51 @@ +#! /bin/sh +# $OpenLDAP$ + +echo "running defines.sh" +. $SRCDIR/scripts/defines.sh + +mkdir -p $TESTDIR $DBDIR1 + +echo "Running slapadd to build slapd database..." +. $CONFFILTER $BACKEND < $CONF > $ADDCONF +$SLAPADD -f $ADDCONF -l $LDIFORDERED +RC=$? +if test $RC != 0 ; then + echo "slapadd failed ($RC)!" + exit $RC +fi + +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 $PORT1 > $SEARCHOUT 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 "Filtering ldapsearch results..." +. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $LDIFFILTER < $LDIF > $LDIFFLT +echo "Comparing filter output..." +$CMP $SEARCHFLT $LDIFFLT > $CMPOUT + +if test $? != 0 ; then + echo "comparison failed - database was not created correctly" + exit 1 +fi + +echo ">>>>> Server1 (pid=$PID) started" +exit 0 diff --git a/tests/scripts/start-server-nolog b/tests/scripts/start-server-nolog new file mode 100755 index 0000000000..ff049f3581 --- /dev/null +++ b/tests/scripts/start-server-nolog @@ -0,0 +1,51 @@ +#! /bin/sh +# $OpenLDAP$ + +echo "running defines.sh" +. $SRCDIR/scripts/defines.sh + +mkdir -p $TESTDIR $DBDIR1 + +echo "Running slapadd to build slapd database..." +. $CONFFILTER $BACKEND < $CONF > $ADDCONF +$SLAPADD -f $ADDCONF -l $LDIFORDERED +RC=$? +if test $RC != 0 ; then + echo "slapadd failed ($RC)!" + exit $RC +fi + +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 $PORT1 > $SEARCHOUT 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 "Filtering ldapsearch results..." +. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT +echo "Filtering original ldif used to create database..." +. $LDIFFILTER < $LDIF > $LDIFFLT +echo "Comparing filter output..." +$CMP $SEARCHFLT $LDIFFLT > $CMPOUT + +if test $? != 0 ; then + echo "comparison failed - database was not created correctly" + exit 1 +fi + +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}'