3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2004 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
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 cp $SQLCONCURRENCYDIR/do_read* $SQLCONCURRENCYDIR/do_search* \
91 echo "Using tester for concurrent server access..."
92 $SLAPDTESTER -P "$PROGDIR" -d "$DATADIR/sql-concurrency" \
93 -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l 5 -j 4
96 if test $RC != 0 ; then
97 echo "slapd-tester failed ($RC)!"
98 test $KILLSERVERS != no && kill -HUP $KILLPIDS
102 echo "Using ldapsearch to retrieve all the entries..."
103 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
104 '(objectClass=*)' > $SEARCHOUT 2>&1
107 test $KILLSERVERS != no && kill -HUP $KILLPIDS
109 if test $RC != 0 ; then
110 echo "ldapsearch failed ($RC)!"
114 echo "Filtering ldapsearch results..."
115 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
116 echo "Comparing filter output..."
117 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
119 if test $? != 0 ; then
120 echo "comparison failed - database was not created correctly"
124 echo ">>>>> Test succeeded"