5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 echo "running defines.sh"
18 . $SRCDIR/scripts/defines.sh
20 echo "Cleaning up in $DBDIR..."
24 echo "Running slapadd to build slapd database..."
25 . $CONFFILTER $BACKEND < $MCONF > $ADDCONF
26 $SLAPADD -f $ADDCONF -l $LDIFORDERED
28 if test $RC != 0 ; then
29 echo "slapadd failed ($RC)!"
33 echo "Running slapindex to index slapd database..."
34 . $CONFFILTER $BACKEND < $CONF > $DBCONF
37 if test $RC != 0 ; then
38 echo "warning: slapindex failed ($RC)"
39 echo " assuming no indexing support"
42 echo "Starting slapd on TCP/IP port $PORT..."
43 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
45 if test $WAIT != 0 ; then
50 echo "Testing slapd searching..."
51 for i in 0 1 2 3 4 5; do
52 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
53 'objectclass=*' > /dev/null 2>&1
55 if test $RC = 1 ; then
56 echo "Waiting 5 seconds for slapd to start..."
61 if test $RC != 0 ; then
62 echo "ldapsearch failed ($RC)!"
67 cat /dev/null > $SEARCHOUT
69 echo "Testing exact searching..."
70 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
71 '(sn:=jensen)' >> $SEARCHOUT 2>&1
72 if test $RC != 0 ; then
73 echo "ldapsearch failed ($RC)!"
78 echo "Testing OR searching..."
79 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
80 '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn:caseExactMatch:=Jones))' >> $SEARCHOUT 2>&1
81 if test $RC != 0 ; then
82 echo "ldapsearch failed ($RC)!"
87 echo "Testing AND matching and ends-with searching..."
88 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
89 '(&(objectclass=groupofnames)(cn=A*))' >> $SEARCHOUT 2>&1
90 if test $RC != 0 ; then
91 echo "ldapsearch failed ($RC)!"
96 echo "Testing NOT searching..."
97 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
98 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
99 if test $RC != 0 ; then
100 echo "ldapsearch failed ($RC)!"
107 LDIF=$SEARCHOUTMASTER
109 echo "Filtering ldapsearch results..."
110 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
111 echo "Filtering original ldif used to create database..."
112 . $LDIFFILTER < $LDIF > $LDIFFLT
113 echo "Comparing filter output..."
114 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
116 if test $? != 0 ; then
117 echo "Comparison failed"
121 echo ">>>>> Test succeeded"