3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2008 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 mkdir -p $TESTDIR $DBDIR1
21 echo "Starting slapd on TCP/IP port $PORT..."
22 . $CONFFILTER $BACKEND $MONITORDB < $SCHEMACONF > $CONF1
23 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
25 if test $WAIT != 0 ; then
33 echo "Using ldapsearch to check that slapd is running..."
34 for i in 0 1 2 3 4 5; do
35 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
36 'objectclass=*' > /dev/null 2>&1
38 if test $RC = 0 ; then
41 echo "Waiting 5 seconds for slapd to start..."
45 echo "Using ldapsearch to read connection monitor entries..."
46 $LDAPSEARCH -S "" -b "$CONNECTIONSMONITORDN" -h $LOCALHOST -p $PORT1 \
48 structuralObjectClass entryDN \
49 monitorConnectionProtocol monitorConnectionOpsReceived \
50 monitorConnectionOpsExecuting monitorConnectionOpsPending \
51 monitorConnectionOpsCompleted monitorConnectionGet \
52 monitorConnectionRead monitorConnectionWrite \
53 monitorConnectionMask monitorConnectionAuthzDN \
54 monitorConnectionListener monitorConnectionLocalAddress \
58 if test $RC != 0 ; then
59 echo "ldapsearch failed ($RC)!"
60 test $KILLSERVERS != no && kill -HUP $KILLPIDS
64 # Compare results, ignoring possible difference of IPv4/IPv6 localhost address
65 localrewrite='s/=127\.0\.0\.1:/=LOCAL:/; s/=\[::1\]:/=LOCAL:/'
66 echo "Filtering ldapsearch results..."
67 sed -e "$localrewrite" < $SEARCHOUT | . $LDIFFILTER > $SEARCHFLT
68 echo "Filtering expected data..."
69 sed -e "$localrewrite" < $MONITOROUT1 | . $LDIFFILTER > $LDIFFLT
70 echo "Comparing filter output..."
71 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
73 if test $? != 0 ; then
74 echo "comparison failed - connection monitor output is not correct"
75 test $KILLSERVERS != no && kill -HUP $KILLPIDS
79 echo "Using ldapsearch to read database monitor entries..."
80 $LDAPSEARCH -S "" -b "$DATABASESMONITORDN" -h $LOCALHOST -p $PORT1 \
82 structuralObjectClass entryDN namingContexts readOnly \
83 monitorIsShadow monitorContext \
84 olmBDBEntryCache olmBDBDNCache olmBDBIDLCache \
88 if test $RC != 0 ; then
89 echo "ldapsearch failed ($RC)!"
90 test $KILLSERVERS != no && kill -HUP $KILLPIDS
94 echo "Filtering ldapsearch results..."
95 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
97 TMPMONITOROUT2=$MONITOROUT2
102 TMPMONITOROUT2=$TESTDIR/monitor2.out
103 grep -v "olmBDB" $MONITOROUT2 > $TMPMONITOROUT2
107 echo "Comparing filter output..."
108 $CMP $SEARCHFLT $TMPMONITOROUT2 > $CMPOUT
110 if test $? != 0 ; then
111 echo "comparison failed - database monitor output is not correct"
112 test $KILLSERVERS != no && kill -HUP $KILLPIDS
116 echo "Using ldapsearch to read statistics monitor entries..."
117 $LDAPSEARCH -S "" -b "$STATISTICSMONITORDN" -h $LOCALHOST -p $PORT1 \
118 '(|(cn=Entries)(cn=PDU)(cn=Referrals))' \
119 structuralObjectClass monitorCounter entryDN \
123 if test $RC != 0 ; then
124 echo "ldapsearch failed ($RC)!"
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
129 echo "Filtering ldapsearch results..."
130 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
132 echo "Comparing filter output..."
133 $CMP $SEARCHFLT $MONITOROUT3 > $CMPOUT
135 if test $? != 0 ; then
136 echo "comparison failed - statistics monitor output is not correct"
137 test $KILLSERVERS != no && kill -HUP $KILLPIDS
141 echo "Using ldapsearch to read operation monitor entries..."
142 $LDAPSEARCH -S "" -b "$OPERATIONSMONITORDN" -h $LOCALHOST -p $PORT1 \
144 structuralObjectClass monitorOpInitiated monitorOpCompleted entryDN \
148 if test $RC != 0 ; then
149 echo "ldapsearch failed ($RC)!"
150 test $KILLSERVERS != no && kill -HUP $KILLPIDS
154 echo "Filtering ldapsearch results..."
155 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
157 echo "Comparing filter output..."
158 $CMP $SEARCHFLT $MONITOROUT4 > $CMPOUT
160 if test $? != 0 ; then
161 echo "comparison failed - operations monitor output is not correct"
162 test $KILLSERVERS != no && kill -HUP $KILLPIDS
166 test $KILLSERVERS != no && kill -HUP $KILLPIDS
168 echo ">>>>> Test succeeded"
170 test $KILLSERVERS != no && wait