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..."
57 if test $RC != 0 ; then
58 echo "ldapsearch failed ($RC)!"
62 echo "Filtering ldapsearch results..."
63 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
64 echo "Filtering original ldif used to create database..."
65 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
66 echo "Comparing filter output..."
67 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
69 if test $? != 0 ; then
70 echo "comparison failed - database was not created correctly"
71 echo $SEARCHFLT $LDIFFLT
72 $DIFF $SEARCHFLT $LDIFFLT
76 echo "OK... Cleaning up in $DBDIR..."
80 echo "Starting slapd on TCP/IP port $PORT..."
81 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
83 if test $WAIT != 0 ; then
88 echo "Using ldapsearch to check that slapd is running..."
89 for i in 0 1 2 3 4 5; do
90 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
91 'objectclass=*' > /dev/null 2>&1
93 if test $RC = 1 ; then
94 echo "Waiting 5 seconds for slapd to start..."
99 echo "Using ldapadd to populate the glued database..."
100 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
101 $LDIFORDERED > $TESTOUT 2>&1
103 if test $RC != 0 ; then
104 echo "ldapadd failed ($RC)!"
109 echo "Using ldapsearch to read all the entries..."
110 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT \
111 'objectclass=*' > $SEARCHOUT 2>&1
115 if test $RC != 0 ; then
116 echo "ldapsearch failed ($RC)!"
120 echo "Filtering ldapsearch results..."
121 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
122 echo "Filtering original ldif used to create database..."
123 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
124 echo "Comparing filter output..."
125 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
127 if test $? != 0 ; then
128 echo "comparison failed - database was not created correctly"
132 echo ">>>>> Test succeeded"