]> git.sur5r.net Git - openldap/blob - tests/scripts/test000-rootdse
e61bc01eaf6a9e9c9313b6113dcfc173d5320bb7
[openldap] / tests / scripts / test000-rootdse
1 #! /bin/sh
2 # $OpenLDAP$
3
4 SRCDIR="."
5 if test $# -ge 1 ; then
6         SRCDIR=$1; shift
7 fi
8 BACKEND=bdb
9 if test $# -ge 1 ; then
10         BACKEND=$1; shift
11 fi
12 MONITORDB=no
13 if test $# -ge 1 ; then
14         MONITORDB=$1; shift
15 fi
16
17 WAIT=0
18 if test $# -ge 1 ; then
19         WAIT=1; shift
20 fi
21
22 echo "running defines.sh"
23 . $SRCDIR/scripts/defines.sh
24
25 echo "Datadir is $DATADIR"
26
27 echo "Cleaning up in $DBDIR..."
28
29 rm -f $DBDIR/[!C]*
30
31 echo "Starting slapd on TCP/IP port $PORT..."
32 . $CONFFILTER $BACKEND $MONITORDB < $SCHEMACONF > $DBCONF
33 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
34 PID=$!
35 if test $WAIT != 0 ; then
36     echo PID $PID
37     read foo
38 fi
39
40 echo "Using ldapsearch to retrieve the root DSE..."
41 for i in 0 1 2 3 4 5; do
42         $LDAPSEARCH -b "" -s base -h $LOCALHOST -p $PORT '+extensibleObject' > $SEARCHOUT 2>&1
43         RC=$?
44         if test $RC = 0 ; then
45                 break
46         fi
47         echo "Waiting 5 seconds for slapd to start..."
48         sleep 5
49 done
50
51 if test $RC = 0 -a $MONITORDB = yes ; then
52         echo "Using ldapsearch to retrieve the cn=Monitor..."
53         $LDAPSEARCH -b "cn=Monitor" -s base -h $LOCALHOST -p $PORT '+extensibleObject' >> $SEARCHOUT 2>&1
54         RC=$?
55 fi
56
57 kill -HUP $PID
58
59 cat $SEARCHOUT
60
61 if test $RC != 0 ; then
62         echo ">>>>> Test failed"
63 else
64         if grep "TLS:" $SEARCHOUT; then
65                 RC=-1
66         else
67             echo ">>>>> Test succeeded"
68         fi
69 fi
70
71
72 exit $RC