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