3 if test $# -eq 0 ; then
8 if test $# -eq 1 ; then
12 echo "running defines.sh $SRCDIR $BACKEND"
13 . $SRCDIR/scripts/defines.sh
15 echo "Cleaning up in $DBDIR..."
19 echo "Running slapadd to build slapd database..."
20 $LDIF2LDBM -f $CONF -l $LDIF
22 if test $RC != 0 ; then
23 echo "slapadd failed!"
27 echo "Starting slapd on TCP/IP port $PORT..."
28 $SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
31 echo "Testing slapd searching..."
32 for i in 0 1 2 3 4 5; do
33 $LDAPSEARCH -s base -b "$MONITOR" -h localhost -p $PORT \
34 'objectclass=*' > /dev/null 2>&1
36 if test $RC = 1 ; then
37 echo "Waiting 5 seconds for slapd to start..."
42 if test $RC != 0 ; then
43 echo "ldapsearch failed!"
48 cat /dev/null > $SEARCHOUT
50 echo "Testing exact searching..."
51 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
52 'sn=jensen' >> $SEARCHOUT 2>&1
53 if test $RC != 0 ; then
54 echo "ldapsearch failed!"
59 echo "Testing OR searching..."
60 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
61 '(|(objectclass=rfc822mailgroup)(sn=jones))' >> $SEARCHOUT 2>&1
62 if test $RC != 0 ; then
63 echo "ldapsearch failed!"
68 echo "Testing AND matching and ends-with searching..."
69 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
70 '(&(objectclass=rfc822mailgroup)(cn=A*))' >> $SEARCHOUT 2>&1
71 if test $RC != 0 ; then
72 echo "ldapsearch failed!"
77 echo "Testing NOT searching..."
78 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
79 '(!(objectclass=person))' >> $SEARCHOUT 2>&1
80 if test $RC != 0 ; then
81 echo "ldapsearch failed!"
90 echo "Filtering ldapsearch results..."
91 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
92 echo "Filtering original ldif used to create database..."
93 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
94 echo "Comparing filter output..."
95 cmp $SEARCHFLT $LDIFFLT
97 if test $? != 0 ; then
98 echo "Comparison failed"
102 echo ">>>>> Test succeeded"