5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 echo "running defines.sh"
18 . $SRCDIR/scripts/defines.sh
20 echo "Cleaning up in $DBDIR..."
22 mkdir $DBDIR/C_db1 $DBDIR/C_db2 $DBDIR/C_db3
24 rm -f $DBDIR/[!C]* $DBDIR/C_db?/*
26 echo "Running slapadd to build glued slapd databases..."
27 . $CONFFILTER $BACKEND < $GLUECONF > $DBCONF
28 $SLAPADD -d $LVL -f $DBCONF -l $LDIFORDERED > $DBDIR/slapadd.log 2>&1
30 if test $RC != 0 ; then
31 echo "slapadd failed ($RC)!"
35 echo "Starting slapd on TCP/IP port $PORT..."
36 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
38 if test $WAIT != 0 ; then
43 echo "Using ldapsearch to retrieve all the entries..."
45 for i in 0 1 2 3 4 5; do
46 ../$LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT > ../$SEARCHOUT 2>&1
48 if test $RC = 1 ; then
49 echo "Waiting 5 seconds for slapd to start..."
56 echo "Sleeping for 5 seconds to let slapd exit..."
59 if test $RC != 0 ; then
60 echo "ldapsearch failed ($RC)!"
64 echo "Filtering ldapsearch results..."
65 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
66 echo "Filtering original ldif used to create database..."
67 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
68 echo "Comparing filter output..."
69 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
71 if test $? != 0 ; then
72 echo "comparison failed - database was not created correctly"
73 echo $SEARCHFLT $LDIFFLT
74 $DIFF $SEARCHFLT $LDIFFLT
78 echo "OK... Cleaning up in $DBDIR..."
82 echo "Starting slapd on TCP/IP port $PORT..."
83 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
85 if test $WAIT != 0 ; then
90 echo "Using ldapsearch to check that slapd is running..."
91 for i in 0 1 2 3 4 5; do
92 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
93 'objectclass=*' > /dev/null 2>&1
95 if test $RC = 1 ; then
96 echo "Waiting 5 seconds for slapd to start..."
101 echo "Using ldapadd to populate the glued database..."
102 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
103 $LDIFORDERED > $TESTOUT 2>&1
105 if test $RC != 0 ; then
106 echo "ldapadd failed ($RC)!"
111 echo "Using ldapsearch to read all the entries..."
112 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT \
113 'objectclass=*' > $SEARCHOUT 2>&1
117 if test $RC != 0 ; then
118 echo "ldapsearch failed ($RC)!"
122 echo "Filtering ldapsearch results..."
123 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
124 echo "Filtering original ldif used to create database..."
125 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
126 echo "Comparing filter output..."
127 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
129 if test $? != 0 ; then
130 echo "comparison failed - database was not created correctly"
134 echo ">>>>> Test succeeded"