4 if test $# -eq 0 ; then
9 if test $# -eq 1 ; then
13 echo "running defines.sh $SRCDIR $BACKEND"
14 . $SRCDIR/scripts/defines.sh
16 echo "Cleaning up in $DBDIR..."
20 echo "Running slapadd to build slapd database..."
21 # $SLAPADD -f $MCONF -l $LDIF
22 $SLAPADD -f $CONF -l $LDIF
24 if test $RC != 0 ; then
25 echo "slapadd failed ($RC)!"
29 # echo "Running slapindex to index slapd database..."
32 # if test $RC != 0 ; then
33 # echo "slapindex failed ($RC)!"
37 echo "Starting slapd on TCP/IP port $PORT..."
38 $SLAPD -f $CONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
41 echo "Testing slapd searching..."
42 for i in 0 1 2 3 4 5; do
43 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 1 ; then
47 echo "Waiting 5 seconds for slapd to start..."
52 if test $RC != 0 ; then
53 echo "ldapsearch failed ($RC)!"
58 cat /dev/null > $SEARCHOUT
60 echo "Testing exact searching..."
61 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
62 'sn=jensen' >> $SEARCHOUT 2>&1
63 if test $RC != 0 ; then
64 echo "ldapsearch failed ($RC)!"
69 echo "Testing OR searching..."
70 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
71 '(|(objectclass=groupofnames)(sn=jones))' >> $SEARCHOUT 2>&1
72 if test $RC != 0 ; then
73 echo "ldapsearch failed ($RC)!"
78 echo "Testing AND matching and ends-with searching..."
79 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
80 '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1
81 if test $RC != 0 ; then
82 echo "ldapsearch failed ($RC)!"
87 echo "Testing NOT searching..."
88 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
89 '(!(objectclass=person))' >> $SEARCHOUT 2>&1
90 if test $RC != 0 ; then
91 echo "ldapsearch failed ($RC)!"
100 echo "Filtering ldapsearch results..."
101 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
102 echo "Filtering original ldif used to create database..."
103 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
104 echo "Comparing filter output..."
105 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
107 if test $? != 0 ; then
108 echo "Comparison failed"
112 echo ">>>>> Test succeeded"