]> git.sur5r.net Git - openldap/blob - tests/data/regressions/its4184/its4184
0428312ae9dd527f28e86402632bf6cc8a854c89
[openldap] / tests / data / regressions / its4184 / its4184
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2017 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
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>.
15
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
18
19 if test "$BACKEND" != "bdb" && test "$BACKEND" != "hdb" ; then
20         echo "Warning: this test is known to affect bdb and hdb, although it may impact other backends as well."
21 fi
22
23 mkdir -p $DBDIR1A $DBDIR2A
24
25 ITS=4184
26 ITSDIR=$DATADIR/regressions/its$ITS
27 USER="uid=user1,ou=People,dc=example,dc=com"
28 PASS="abc"
29
30 echo "Running slapadd to build slapd database..."
31 . $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd.conf > $CONF1
32 $SLAPADD -f $CONF1 -l $ITSDIR/adds.ldif
33 RC=$?
34 if test $RC != 0 ; then
35         echo "slapadd failed ($RC)!"
36         exit $RC
37 fi
38
39 echo "Starting slapd on TCP/IP port $PORT1..."
40 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
41 PID=$!
42 if test $WAIT != 0 ; then
43     echo PID $PID
44     read foo
45 fi
46 KILLPIDS="$PID"
47
48 sleep 1
49
50 for i in 0 1 2 3 4 5; do
51         $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
52                 '(objectClass=*)' > /dev/null 2>&1
53         RC=$?
54         if test $RC = 0 ; then
55                 break
56         fi
57         echo "Waiting 5 seconds for slapd to start..."
58         sleep 5
59 done
60
61 if test $RC != 0 ; then
62         echo "ldapsearch failed ($RC)!"
63         test $KILLSERVERS != no && kill -HUP $KILLPIDS
64         exit $RC
65 fi
66
67 echo ""
68 echo "  This test applies a round of updates __after__ grabbing a lock"
69 echo "  that, before the fix, was not correctly released; in case "
70 echo "  of failure, the second round of updates will deadlock."
71 echo "  This issue was fixed in OpenLDAP 2.3.14."
72 echo ""
73
74 for S in 1 2 ; do
75         FILE="${ITSDIR}/mods.ldif"
76         echo "${S}) Applying `basename ${FILE}`..."
77         $LDAPMODIFY -v -D "$USER" -w $PASS -h $LOCALHOST -p $PORT1 \
78                 -f "${FILE}" > $TESTOUT 2>&1 
79         RC=$?
80         if test $RC != 0 ; then
81                 echo "ldapmodify failed ($RC)!"
82                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
83                 exit $RC
84         fi
85         sleep 1
86 done
87
88 test $KILLSERVERS != no && kill -HUP $KILLPIDS
89
90 echo ">>>>> Test succeeded"
91
92 test $KILLSERVERS != no && wait
93
94 exit 0