]> git.sur5r.net Git - openldap/blob - tests/data/regressions/its6794/its6794
Happy New Year
[openldap] / tests / data / regressions / its6794 / its6794
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2018 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 rm -rf $TESTDIR
20
21 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR1C
22 ITS=6794
23 ITSDIR=$DATADIR/regressions/its$ITS
24 ITSCONF=$ITSDIR/slapd-glue.conf
25
26 echo "Running multi-threaded slapadd in quick mode to build glued slapd databases..."
27 . $CONFFILTER $BACKEND $MONITORDB < $ITSCONF > $CONF1
28 $SLAPADD -q -d $LVL -f $CONF1 -l $LDIFORDERED > $SLAPADDLOG1 2>&1
29 RC=$?
30 if test $RC != 0 ; then
31         echo "slapadd failed ($RC)!"
32         exit $RC
33 fi
34
35 echo "Starting slapd on TCP/IP port $PORT1..."
36 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
37 PID=$!
38 if test $WAIT != 0 ; then
39     echo PID $PID
40     read foo
41 fi
42 KILLPIDS="$PID"
43
44 sleep 1
45
46 echo "Using ldapsearch to retrieve all the entries..."
47 for i in 0 1 2 3 4 5; do
48         $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
49         RC=$?
50         if test $RC = 0 ; then
51                 break
52         fi
53         echo "Waiting 5 seconds for slapd to start..."
54         sleep 5
55 done
56
57 if test $RC != 0 ; then
58         echo "ldapsearch failed ($RC)!"
59         test $KILLSERVERS != no && kill -HUP $KILLPIDS
60         exit $RC
61 fi
62
63 echo "Filtering ldapsearch results..."
64 $LDIFFILTER -s ldif=e < $SEARCHOUT > $SEARCHFLT
65 echo "Filtering original ldif used to create database..."
66 $LDIFFILTER -s ldif=e < $LDIFGLUED > $LDIFFLT
67 echo "Comparing filter output..."
68 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
69
70 if test $? != 0 ; then
71         echo "comparison failed - database was not created correctly"
72         echo $SEARCHFLT $LDIFFLT
73         $DIFF $SEARCHFLT $LDIFFLT
74         test $KILLSERVERS != no && kill -HUP $KILLPIDS
75         exit 1
76 fi
77
78 test $KILLSERVERS != no && kill -HUP $KILLPIDS
79
80 echo ">>>>> Test succeeded"
81
82 test $KILLSERVERS != no && wait
83
84 exit 0