]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Add/update server startup scripts
authorKurt Zeilenga <kurt@openldap.org>
Fri, 24 Oct 2003 03:35:20 +0000 (03:35 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 24 Oct 2003 03:35:20 +0000 (03:35 +0000)
tests/data/slapd2.conf [new file with mode: 0644]
tests/run.in
tests/scripts/defines.sh
tests/scripts/start-server [moved from tests/scripts/start-master with 64% similarity]
tests/scripts/start-server-nolog [moved from tests/scripts/start-master-nolog with 64% similarity]
tests/scripts/start-server2 [new file with mode: 0755]
tests/scripts/start-server2-nolog [new file with mode: 0755]
tests/scripts/stripattr.sh [deleted file]

diff --git a/tests/data/slapd2.conf b/tests/data/slapd2.conf
new file mode 100644 (file)
index 0000000..1f4c1bb
--- /dev/null
@@ -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
+
index 8bceaded12f95a0ccf7296e112ce8b9689e1d230..bef3bcfbfd867210304ece7106e6139fe2c98314 100644 (file)
@@ -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
index 34cead85275a00963b2580a3d16cd9647b6f2da2..75e461340b6db998323aa17b3b37be5fbcae8235 100755 (executable)
@@ -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
similarity index 64%
rename from tests/scripts/start-master
rename to tests/scripts/start-server
index bbad878074ff960e28e5f94fb960b03fd887df6b..f73096d574fdde253b46cb9295648c31eb0f6d5b 100755 (executable)
@@ -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
similarity index 64%
rename from tests/scripts/start-master-nolog
rename to tests/scripts/start-server-nolog
index 0dedcb752ac208e905b6e3422b7e3a63f32788b9..ff049f3581d005b668e2fe984b79142986b851ea 100755 (executable)
@@ -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 (executable)
index 0000000..1c8b195
--- /dev/null
@@ -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 (executable)
index 0000000..29a06e0
--- /dev/null
@@ -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 (executable)
index 5645e02..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-#
-# Strip attribute from LDIF
-#
-awk '/^'$1'/ {getline; while (substr($0,1,1) == " ") getline;} /.*/ {print $0}'