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 $LDIF2LDBM -f $CONF -l $LDIF
23 if test $RC != 0 ; then
24 echo "slapadd failed!"
28 echo "Starting slapd on TCP/IP port $PORT..."
29 $SLAPD -f $CONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
32 echo "Testing slapd searching..."
33 for i in 0 1 2 3 4 5; do
34 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
35 'objectclass=*' > /dev/null 2>&1
37 if test $RC = 1 ; then
38 echo "Waiting 5 seconds for slapd to start..."
43 if test $RC != 0 ; then
44 echo "ldapsearch failed!"
49 cat /dev/null > $SEARCHOUT
51 echo "Testing exact searching..."
52 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
53 'sn=jensen' >> $SEARCHOUT 2>&1
54 if test $RC != 0 ; then
55 echo "ldapsearch failed!"
60 echo "Testing OR searching..."
61 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
62 '(|(objectclass=groupofnames)(sn=jones))' >> $SEARCHOUT 2>&1
63 if test $RC != 0 ; then
64 echo "ldapsearch failed!"
69 echo "Testing AND matching and ends-with searching..."
70 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
71 '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1
72 if test $RC != 0 ; then
73 echo "ldapsearch failed!"
78 echo "Testing NOT searching..."
79 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
80 '(!(objectclass=person))' >> $SEARCHOUT 2>&1
81 if test $RC != 0 ; then
82 echo "ldapsearch failed!"
91 echo "Filtering ldapsearch results..."
92 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
93 echo "Filtering original ldif used to create database..."
94 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
95 echo "Comparing filter output..."
96 $CMP $SEARCHFLT $LDIFFLT
98 if test $? != 0 ; then
99 echo "Comparison failed"
103 echo ">>>>> Test succeeded"