5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
14 echo "Cleaning up in $DBDIR..."
16 mkdir $DBDIR/C_db1 $DBDIR/C_db2 $DBDIR/C_db3
18 rm -f $DBDIR/[!C]* $DBDIR/C_db?/*
20 echo "Running slapadd to build glued slapd databases..."
21 . $CONFFILTER $BACKEND $MONITORDB < $GLUECONF > $DBCONF
22 $SLAPADD -d $LVL -f $DBCONF -l $LDIFORDERED > $DBDIR/slapadd.log 2>&1
24 if test $RC != 0 ; then
25 echo "slapadd failed ($RC)!"
29 echo "Starting slapd on TCP/IP port $PORT..."
30 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
32 if test $WAIT != 0 ; then
37 echo "Using ldapsearch to retrieve all the entries..."
39 for i in 0 1 2 3 4 5; do
40 ../$LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT > ../$SEARCHOUT 2>&1
42 if test $RC = 0 ; then
45 echo "Waiting 5 seconds for slapd to start..."
51 echo "Sleeping for 5 seconds to let slapd exit..."
54 if test $RC != 0 ; then
55 echo "ldapsearch failed ($RC)!"
59 echo "Filtering ldapsearch results..."
60 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
61 echo "Filtering original ldif used to create database..."
62 . $LDIFFILTER < $LDIFGLUED > $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
73 echo "OK... Cleaning up in $DBDIR..."
77 echo "Starting slapd on TCP/IP port $PORT..."
78 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
80 if test $WAIT != 0 ; then
85 echo "Using ldapsearch to check that slapd is running..."
86 for i in 0 1 2 3 4 5; do
87 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
88 'objectclass=*' > /dev/null 2>&1
90 if test $RC = 0 ; then
93 echo "Waiting 5 seconds for slapd to start..."
97 echo "Using ldapadd to populate the glued database..."
98 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
99 $LDIFORDERED > $TESTOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapadd failed ($RC)!"
107 echo "Using ldapsearch to read all the entries..."
108 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT \
109 'objectclass=*' > $SEARCHOUT 2>&1
114 if test $RC != 0 ; then
115 echo "ldapsearch failed ($RC)!"
119 echo "Filtering ldapsearch results..."
120 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
121 echo "Filtering original ldif used to create database..."
122 . $LDIFFILTER < $LDIFGLUED > $LDIFFLT
123 echo "Comparing filter output..."
124 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
126 if test $? != 0 ; then
127 echo "comparison failed - database was not created correctly"
131 echo ">>>>> Test succeeded"