3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2012 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 if test "x$TESTLOOPS" = "x" ; then
33 if test "x$CHILDREN" = "x" ; then
36 CHILDREN="-j $CHILDREN"
39 SQLDATADIR=$TESTDIR/sql-concurrency
40 mkdir -p $TESTDIR $SQLDATADIR
42 echo "Starting slapd on TCP/IP port $PORT1..."
43 . $CONFFILTER $BACKEND $MONITORDB < $SQLCONF > $CONF1
44 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
46 if test $WAIT != 0 ; then
52 echo "Testing SQL backend concurrency..."
53 for i in 0 1 2 3 4 5; do
54 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
55 'objectclass=*' > /dev/null 2>&1
57 if test $RC = 0 ; then
60 echo "Waiting 5 seconds for slapd to start..."
64 if test $RC != 0 ; then
65 echo "ldapsearch failed ($RC)!"
66 test $KILLSERVERS != no && kill -HUP $KILLPIDS
70 echo "Using ldapsearch to retrieve all the entries..."
71 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
72 '(objectClass=*)' > $SEARCHOUT 2>&1
75 if test $RC != 0 ; then
76 echo "ldapsearch failed ($RC)!"
77 test $KILLSERVERS != no && kill -HUP $KILLPIDS
81 echo "Filtering original ldif used to create database..."
82 $LDIFFILTER < $SEARCHOUT > $LDIFFLT
84 if test "${RDBMSWRITE}" != "yes"; then
85 echo "write test disabled for ${RDBMS}; set SLAPD_USE_SQLWRITE=yes to enable"
86 cp $SQLCONCURRENCYDIR/do_read* $SQLCONCURRENCYDIR/do_search* \
87 $SQLCONCURRENCYDIR/do_bind* $SQLDATADIR
90 # list here the RDBMSes whose mapping allows writes
92 cp $SQLCONCURRENCYDIR/do_* $SQLDATADIR
95 echo "write is not supported for ${RDBMS}; performing read-only concurrency test"
96 cp $SQLCONCURRENCYDIR/do_read* $SQLCONCURRENCYDIR/do_search* \
97 $SQLCONCURRENCYDIR/do_bind* $SQLDATADIR
102 echo "Using tester for concurrent server access..."
103 $SLAPDTESTER -P "$PROGDIR" -d "$SQLDATADIR" \
104 -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD \
105 -l $TESTLOOPS $CHILDREN -FF
108 if test $RC != 0 ; then
109 echo "slapd-tester failed ($RC)!"
110 test $KILLSERVERS != no && kill -HUP $KILLPIDS
114 echo "Using ldapsearch to retrieve all the entries..."
115 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
116 '(objectClass=*)' > $SEARCHOUT 2>&1
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 if test $RC != 0 ; then
122 echo "ldapsearch failed ($RC)!"
126 echo "Filtering ldapsearch results..."
127 $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
128 echo "Comparing filter output..."
129 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
131 if test $? != 0 ; then
132 echo "comparison failed - database was not created correctly"
136 echo ">>>>> Test succeeded"