~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to tests/data/regressions/its4336/its4336

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2008-07-10 14:45:49 UTC
  • Revision ID: james.westby@ubuntu.com-20080710144549-wck73med0e72gfyo
Tags: upstream-2.4.10
ImportĀ upstreamĀ versionĀ 2.4.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# $OpenLDAP: pkg/ldap/tests/data/regressions/its4336/its4336,v 1.2.2.3 2008/02/11 23:26:50 kurt Exp $
 
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 
4
##
 
5
## Copyright 1998-2008 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 $BACKLDAP = "ldapno" ; then 
 
20
        echo "LDAP backend not available, test skipped"
 
21
        exit 0
 
22
fi 
 
23
 
 
24
if test $RETCODE = retcodeno; then 
 
25
        echo "Retcode overlay not available, test skipped"
 
26
        exit 0
 
27
fi 
 
28
 
 
29
mkdir -p $TESTDIR $DBDIR1
 
30
 
 
31
ITS=4336
 
32
ITSDIR=$DATADIR/regressions/its$ITS
 
33
 
 
34
echo "Running slapadd to build slapd database..."
 
35
. $CONFFILTER $BACKEND $MONITORDB < $RETCODECONF > $CONF1
 
36
$SLAPADD -f $CONF1 -l $LDIFORDERED
 
37
RC=$?
 
38
if test $RC != 0 ; then
 
39
        echo "slapadd failed ($RC)!"
 
40
        exit $RC
 
41
fi
 
42
 
 
43
echo "Starting slapd on TCP/IP port $PORT1..."
 
44
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
 
45
SERVERPID=$!
 
46
if test $WAIT != 0 ; then
 
47
    echo SERVERPID $SERVERPID
 
48
    read foo
 
49
fi
 
50
KILLPIDS="$SERVERPID"
 
51
 
 
52
sleep 1
 
53
 
 
54
echo "Using ldapsearch to check that slapd is running..."
 
55
for i in 0 1 2 3 4 5; do
 
56
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
 
57
                'objectclass=*' > /dev/null 2>&1
 
58
        RC=$?
 
59
        if test $RC = 0 ; then
 
60
                break
 
61
        fi
 
62
        echo "Waiting 5 seconds for slapd to start..."
 
63
        sleep 5
 
64
done
 
65
 
 
66
if test $RC != 0 ; then
 
67
        echo "ldapsearch failed ($RC)!"
 
68
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
69
        exit $RC
 
70
fi
 
71
 
 
72
echo "Starting chain slapd on TCP/IP port $PORT2..."
 
73
. $CONFFILTER $BACKEND $MONITORDB < $ITSDIR/slapd.conf > $CONF2
 
74
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
 
75
PROXYPID=$!
 
76
if test $WAIT != 0 ; then
 
77
    echo PROXYPID $PROXYPID
 
78
    read foo
 
79
fi
 
80
KILLPIDS="$KILLPIDS $PROXYPID"
 
81
 
 
82
sleep 1
 
83
 
 
84
echo "Using ldapsearch to check that chain slapd is running..."
 
85
for i in 0 1 2 3 4 5; do
 
86
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
 
87
                'objectclass=*' > /dev/null 2>&1
 
88
        RC=$?
 
89
        if test $RC = 0 ; then
 
90
                break
 
91
        fi
 
92
        echo "Waiting 5 seconds for slapd to start..."
 
93
        sleep 5
 
94
done
 
95
 
 
96
if test $RC != 0 ; then
 
97
        echo "ldapsearch failed ($RC)!"
 
98
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
99
        exit $RC
 
100
fi
 
101
 
 
102
echo "Searching the chain..."
 
103
echo "
 
104
        Search an entry that causes a successful result to be returned
 
105
        with a 2 second delay; since size/time limits were erroneously
 
106
        set to 0/0, which internally means 0 instead of unlimited, the
 
107
        underlying back-ldap search timed out.
 
108
"
 
109
$LDAPSEARCH -b "cn=success w/ delay,ou=RetCodes,$BASEDN" -h $LOCALHOST -p $PORT2 \
 
110
        '(objectClass=*)' > /dev/null 2>&1
 
111
RC=$?
 
112
if test $RC != 0 ; then
 
113
        echo "ldapsearch failed ($RC)!"
 
114
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
115
        exit $RC
 
116
fi
 
117
 
 
118
echo "Re-searching the chain..."
 
119
$LDAPSEARCH -b "cn=success w/ delay,ou=RetCodes,$BASEDN" -h $LOCALHOST -p $PORT2 \
 
120
        '(objectClass=*)' > /dev/null 2>&1
 
121
RC=$?
 
122
if test $RC != 0 ; then
 
123
        echo "ldapsearch failed ($RC)!"
 
124
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
125
        exit $RC
 
126
fi
 
127
 
 
128
test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
129
 
 
130
echo ">>>>> Test succeeded"
 
131
 
 
132
test $KILLSERVERS != no && wait
 
133
 
 
134
exit 0