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 = 1 ; then
53 echo "Waiting 5 seconds for slapd to start..."
60 echo "Sleeping for 5 seconds to let slapd exit..."
63 if test $RC != 0 ; then
64 echo "ldapsearch failed ($RC)!"
68 echo "Filtering ldapsearch results..."
69 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
70 echo "Filtering original ldif used to create database..."
71 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
72 echo "Comparing filter output..."
73 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
75 if test $? != 0 ; then
76 echo "comparison failed - database was not created correctly"
77 echo $SEARCHFLT $LDIFFLT
78 $DIFF $SEARCHFLT $LDIFFLT
82 echo "OK... Cleaning up in $DBDIR..."
86 echo "Starting slapd on TCP/IP port $PORT..."
87 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
89 if test $WAIT != 0 ; then
94 echo "Using ldapsearch to check that slapd is running..."
95 for i in 0 1 2 3 4 5; do
96 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
97 'objectclass=*' > /dev/null 2>&1
99 if test $RC = 1 ; then
100 echo "Waiting 5 seconds for slapd to start..."
105 echo "Using ldapadd to populate the glued database..."
106 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
107 $LDIFORDERED > $TESTOUT 2>&1
109 if test $RC != 0 ; then
110 echo "ldapadd failed ($RC)!"
115 echo "Using ldapsearch to read all the entries..."
116 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT \
117 'objectclass=*' > $SEARCHOUT 2>&1
122 if test $RC != 0 ; then
123 echo "ldapsearch failed ($RC)!"
127 echo "Filtering ldapsearch results..."
128 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
129 echo "Filtering original ldif used to create database..."
130 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
131 echo "Comparing filter output..."
132 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
134 if test $? != 0 ; then
135 echo "comparison failed - database was not created correctly"
139 echo ">>>>> Test succeeded"