5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 if test $# -ge 1 ; then
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
24 echo "Cleaning up in $DBDIR..."
26 mkdir $DBDIR/C_db1 $DBDIR/C_db2 $DBDIR/C_db3
28 rm -f $DBDIR/[!C]* $DBDIR/C_db?/*
30 echo "Running slapadd to build glued slapd databases..."
31 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $DBCONF
32 $SLAPADD -d $LVL -f $DBCONF -l $LDIFORDERED > $DBDIR/slapadd.log 2>&1
34 if test $RC != 0 ; then
35 echo "slapadd failed ($RC)!"
39 echo "Starting slapd on TCP/IP port $PORT..."
40 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
42 if test $WAIT != 0 ; then
47 echo "Using ldapsearch to retrieve all the entries..."
49 for i in 0 1 2 3 4 5; do
50 ../$LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT > ../$SEARCHOUT 2>&1
52 if test $RC = 0 ; then
55 echo "Waiting 5 seconds for slapd to start..."
61 echo "Sleeping for 5 seconds to let slapd exit..."
64 if test $RC != 0 ; then
65 echo "ldapsearch failed ($RC)!"
69 echo "Filtering ldapsearch results..."
70 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
71 echo "Filtering original ldif used to create database..."
72 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
73 echo "Comparing filter output..."
74 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
76 if test $? != 0 ; then
77 echo "comparison failed - database was not created correctly"
78 echo $SEARCHFLT $LDIFFLT
79 $DIFF $SEARCHFLT $LDIFFLT
83 echo "OK... Cleaning up in $DBDIR..."
87 echo "Starting slapd on TCP/IP port $PORT..."
88 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
90 if test $WAIT != 0 ; then
95 echo "Using ldapsearch to check that slapd is running..."
96 for i in 0 1 2 3 4 5; do
97 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
98 'objectclass=*' > /dev/null 2>&1
100 if test $RC = 0 ; then
103 echo "Waiting 5 seconds for slapd to start..."
107 echo "Using ldapadd to populate the glued database..."
108 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
109 $LDIFORDERED > $TESTOUT 2>&1
111 if test $RC != 0 ; then
112 echo "ldapadd failed ($RC)!"
117 echo "Using ldapsearch to read all the entries..."
118 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT \
119 'objectclass=*' > $SEARCHOUT 2>&1
124 if test $RC != 0 ; then
125 echo "ldapsearch failed ($RC)!"
129 echo "Filtering ldapsearch results..."
130 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
131 echo "Filtering original ldif used to create database..."
132 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
133 echo "Comparing filter output..."
134 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
136 if test $? != 0 ; then
137 echo "comparison failed - database was not created correctly"
141 echo ">>>>> Test succeeded"