]> git.sur5r.net Git - openldap/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-master [deleted file]
tests/scripts/start-master-nolog [deleted file]
tests/scripts/start-server [new file with mode: 0755]
tests/scripts/start-server-nolog [new file with mode: 0755]
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
diff --git a/tests/scripts/start-master b/tests/scripts/start-master
deleted file mode 100755 (executable)
index bbad878..0000000
+++ /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 (executable)
index 0dedcb7..0000000
+++ /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 (executable)
index 0000000..f73096d
--- /dev/null
@@ -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 (executable)
index 0000000..ff049f3
--- /dev/null
@@ -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 (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}'