3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 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 if test $BACKSQL = "sqlno" ; then
20 echo "SQL backend not available, test skipped"
24 if test $RDBMS = "rdbmsno" ; then
25 echo "SQL test not requested, test skipped"
29 SQLDATADIR=$TESTDIR/sql-concurrency
30 mkdir -p $TESTDIR $SQLDATADIR
32 echo "Starting slapd on TCP/IP port $PORT1..."
33 . $CONFFILTER $BACKEND $MONITORDB < $SQLCONF > $CONF1
34 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
36 if test $WAIT != 0 ; then
42 echo "Testing SQL backend concurrency..."
43 for i in 0 1 2 3 4 5; do
44 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
45 'objectclass=*' > /dev/null 2>&1
47 if test $RC = 0 ; then
50 echo "Waiting 5 seconds for slapd to start..."
54 if test $RC != 0 ; then
55 echo "ldapsearch failed ($RC)!"
56 test $KILLSERVERS != no && kill -HUP $KILLPIDS
60 echo "Using ldapsearch to retrieve all the entries..."
61 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
62 '(objectClass=*)' > $SEARCHOUT 2>&1
65 if test $RC != 0 ; then
66 echo "ldapsearch failed ($RC)!"
67 test $KILLSERVERS != no && kill -HUP $KILLPIDS
71 echo "Filtering original ldif used to create database..."
72 . $LDIFFILTER < $SEARCHOUT > $LDIFFLT
74 if test "${RDBMSWRITE}" != "yes"; then
75 echo "write test disabled for ${RDBMS}; set SLAPD_USE_SQLWRITE=yes to enable"
76 cp $SQLCONCURRENCYDIR/do_read* $SQLCONCURRENCYDIR/do_search* \
80 # list here the RDBMSes whose mapping allows writes
82 cp $SQLCONCURRENCYDIR/do_* $SQLDATADIR
85 echo "write is not supported for ${RDBMS}; performing read-only concurrency test"
86 cp $SQLCONCURRENCYDIR/do_read* $SQLCONCURRENCYDIR/do_search* \
92 echo "Using tester for concurrent server access..."
93 $SLAPDTESTER -P "$PROGDIR" -d "$SQLDATADIR" \
94 -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l 5 -j 4
97 if test $RC != 0 ; then
98 echo "slapd-tester failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
103 echo "Using ldapsearch to retrieve all the entries..."
104 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
105 '(objectClass=*)' > $SEARCHOUT 2>&1
108 test $KILLSERVERS != no && kill -HUP $KILLPIDS
110 if test $RC != 0 ; then
111 echo "ldapsearch failed ($RC)!"
115 echo "Filtering ldapsearch results..."
116 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
117 echo "Comparing filter output..."
118 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
120 if test $? != 0 ; then
121 echo "comparison failed - database was not created correctly"
125 echo ">>>>> Test succeeded"