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 mkdir -p $TESTDIR $DBDIR1
21 echo "Running slapadd to build slapd database..."
22 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $ADDCONF
23 $SLAPADD -f $ADDCONF -l $LDIFORDERED
25 if test $RC != 0 ; then
26 echo "slapadd failed ($RC)!"
30 echo "Starting slapd on TCP/IP port $PORT1..."
31 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
32 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
34 if test $WAIT != 0 ; then
42 echo "Using ldapsearch to retrieve all the entries..."
43 for i in 0 1 2 3 4 5; do
44 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
46 if test $RC = 0 ; then
49 echo "Waiting 5 seconds for slapd to start..."
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 echo "Filtering ldapsearch results..."
60 $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
61 echo "Filtering original ldif used to create database..."
62 $LDIFFILTER < $LDIF > $LDIFFLT
63 echo "Comparing filter output..."
64 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
66 if test $? != 0 ; then
67 echo "comparison failed - database was not created correctly"
68 echo $SEARCHFLT $LDIFFLT
69 $DIFF $SEARCHFLT $LDIFFLT
70 test $KILLSERVERS != no && kill -HUP $KILLPIDS
74 if test $BACKEND = ldif ; then
75 echo "Skipping test of unordered slapadd (unsupported in ldif backend)"
82 BASE2="ou=test,dc=example,dc=com"
83 sed -e "s;$BASEDN;$BASE2;" $ADDCONF > ${ADDCONF}2
84 mv ${ADDCONF}2 $ADDCONF
85 sed -e "s;$BASEDN;$BASE2;" $CONF1 > ${CONF1}2
87 echo "Running slapadd with unordered LDIF..."
88 $SLAPADD -f $ADDCONF -l $LDIFUNORDERED
90 if test $RC != 0 ; then
91 echo "slapadd failed ($RC)!"
95 echo "Starting slapd on TCP/IP port $PORT1..."
96 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
98 if test $WAIT != 0 ; then
106 echo "Using ldapsearch to retrieve all the entries..."
107 for i in 0 1 2 3 4 5; do
108 $LDAPSEARCH -b "$BASE2" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
110 if test $RC = 0 ; then
113 echo "Waiting 5 seconds for slapd to start..."
117 if test $RC != 0 ; then
118 echo "ldapsearch failed ($RC)!"
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Filtering ldapsearch results..."
124 $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
125 echo "Filtering original ldif used to create database..."
126 $LDIFFILTER < $LDIFREORDERED > $LDIFFLT
127 echo "Comparing filter output..."
128 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
130 if test $? != 0 ; then
131 echo "comparison failed - database was not created correctly"
132 echo $SEARCHFLT $LDIFFLT
133 $DIFF $SEARCHFLT $LDIFFLT
134 test $KILLSERVERS != no && kill -HUP $KILLPIDS
140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
142 echo ">>>>> Test succeeded"
144 test $KILLSERVERS != no && wait