3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2011 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 # The default debug level logs more than 1Gb:
17 SLAPD_DEBUG=${SLAPD_DEBUG_MT_HOT-stats}
19 echo "running defines.sh"
20 . $SRCDIR/scripts/defines.sh
22 if test $MONITORDB = "no" ; then
23 echo "Monitor backend not available, test skipped"
27 mkdir -p $TESTDIR $DBDIR1
30 # Populate and start up slapd server with some random data
33 echo "Running slapadd to build slapd database..."
34 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
35 $SLAPADD -f $ADDCONF -l $LDIFORDERED
37 if test $RC != 0 ; then
38 echo "slapadd failed ($RC)!"
42 echo "Running slapindex to index slapd database..."
43 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
46 if test $RC != 0 ; then
47 echo "warning: slapindex failed ($RC)"
48 echo " assuming no indexing support"
51 echo "Starting slapd on TCP/IP port $PORT1..."
52 echo $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING
53 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
55 if test $WAIT != 0 ; then
63 # Perform a basic search, make sure of a functional setup
64 echo "Testing basic monitor search..."
65 for i in 0 1 2 3 4 5; do
66 $LDAPSEARCH -s base -b "$MONITORDN" -H $URI1 \
67 '(objectclass=*)' > /dev/null 2>&1
69 if test $RC = 0 ; then
72 echo "Waiting 5 seconds for slapd to start..."
76 if test $RC != 0 ; then
77 echo "mt-hot read failed ($RC)!"
78 test $KILLSERVERS != no && kill -HUP $KILLPIDS
82 cat /dev/null > $MTREADOUT
84 echo "Monitor searches"
85 # Perform a basic single threaded search on a single connection
89 echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..."
90 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
92 -m $THR -L $OUTER -l $INNER
93 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
94 -e "$MONITORDN" -f "(objectclass=*)" \
95 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
97 if test $RC != 0 ; then
98 echo "slapd-mtread failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
103 # Perform a basic multi-threaded search on a single connection
107 echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..."
108 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
110 -m $THR -L $OUTER -l $INNER
111 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
112 -e "$MONITORDN" -f "(objectclass=*)" \
113 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
115 if test $RC != 0 ; then
116 echo "slapd-mtread failed ($RC)!"
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 # Perform a basic multi-threaded search on a single connection
125 echo "Testing basic mt-hot search: $THR threads ($OUTER x $INNER) loops..."
126 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
128 -m $THR -L $OUTER -l $INNER
129 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
130 -e "$MONITORDN" -f "(objectclass=*)" \
131 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
133 if test $RC != 0 ; then
134 echo "slapd-mtread failed ($RC)!"
135 test $KILLSERVERS != no && kill -HUP $KILLPIDS
139 # Perform a single threaded random DB search on a single connection
140 echo "Random searches"
144 echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..."
145 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
146 -e "$BASEDN" -f "(objectclass=*)" \
147 -m $THR -L $OUTER -l $INNER
148 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
149 -e "$BASEDN" -f "(objectclass=*)" \
150 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
152 if test $RC != 0 ; then
153 echo "slapd-mtread failed ($RC)!"
154 test $KILLSERVERS != no && kill -HUP $KILLPIDS
158 # Perform a multi-threaded random DB search on a single connection
162 echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..."
163 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
164 -e "$BASEDN" -f "(objectclass=*)" \
165 -m $THR -L $OUTER -l $INNER
166 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
167 -e "$BASEDN" -f "(objectclass=*)" \
168 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
170 if test $RC != 0 ; then
171 echo "slapd-mtread failed ($RC)!"
172 test $KILLSERVERS != no && kill -HUP $KILLPIDS
176 # Perform a multi-threaded random DB search on a single connection
180 echo "Testing random mt-hot search: $THR threads ($OUTER x $INNER) loops..."
181 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
182 -e "$BASEDN" -f "(objectclass=*)" \
183 -m $THR -L $OUTER -l $INNER
184 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
185 -e "$BASEDN" -f "(objectclass=*)" \
186 -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
188 if test $RC != 0 ; then
189 echo "slapd-mtread failed ($RC)!"
190 test $KILLSERVERS != no && kill -HUP $KILLPIDS
194 # Perform a basic multi-threaded search using multiple connections
195 echo "Multiple threads and connection searches"
200 echo "Testing basic mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..."
201 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
203 -c $CONN -m $THR -L $OUTER -l $INNER
204 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
205 -e "$MONITORDN" -f "(objectclass=*)" \
206 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
208 if test $RC != 0 ; then
209 echo "slapd-mtread failed ($RC)!"
210 test $KILLSERVERS != no && kill -HUP $KILLPIDS
214 # Perform a basic multi-threaded search using multiple connections
219 echo "Testing basic mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..."
220 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
222 -c $CONN -m $THR -L $OUTER -l $INNER
223 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
224 -e "$MONITORDN" -f "(objectclass=*)" \
225 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
227 if test $RC != 0 ; then
228 echo "slapd-mtread failed ($RC)!"
229 test $KILLSERVERS != no && kill -HUP $KILLPIDS
233 # Perform a multi-threaded random DB search using multiple connections
238 echo "Testing random mt-hot search: $THR threads $CONN conns ($OUTER x $INNER) loops..."
239 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
240 -e "$BASEDN" -f "(objectclass=*)" \
241 -c $CONN -m $THR -L $OUTER -l $INNER
242 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
243 -e "$BASEDN" -f "(objectclass=*)" \
244 -c $CONN -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
246 if test $RC != 0 ; then
247 echo "slapd-mtread failed ($RC)!"
248 test $KILLSERVERS != no && kill -HUP $KILLPIDS
252 # Perform a multi-threaded random reads and writes using single connection
258 echo "Testing random mt-hot r/w search: $THR read threads $WTHR write threads $CONN conns ($OUTER x $INNER) loops..."
259 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
260 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
261 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER
262 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
263 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
264 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
266 if test $RC != 0 ; then
267 echo "slapd-mtread failed ($RC)!"
268 test $KILLSERVERS != no && kill -HUP $KILLPIDS
272 # Perform a multi-threaded random reads and writes using multiple connections
278 echo "Testing random mt-hot r/w search: $THR read threads $WTHR write threads $CONN conns ($OUTER x $INNER) loops..."
279 echo $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
280 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
281 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER
282 $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD \
283 -e "$BASEDN" -f "(&(!(cn=rwtest*))(objectclass=*))" \
284 -c $CONN -m $THR -M $WTHR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
286 if test $RC != 0 ; then
287 echo "slapd-mtread failed ($RC)!"
288 test $KILLSERVERS != no && kill -HUP $KILLPIDS
293 test $KILLSERVERS != no && kill -HUP $KILLPIDS
295 echo ">>>>> Test succeeded"