5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 if test $# -ge 1 ; then
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
24 echo "Cleaning up in $DBDIR..."
28 echo "Running slapadd to build slapd database..."
29 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
30 $SLAPADD -f $ADDCONF -l $LDIFORDERED
32 if test $RC != 0 ; then
33 echo "slapadd failed ($RC)!"
37 echo "Running slapindex to index slapd database..."
38 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $DBCONF
41 if test $RC != 0 ; then
42 echo "warning: slapindex failed ($RC)"
43 echo " assuming no indexing support"
46 echo "Starting slapd on TCP/IP port $PORT..."
47 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
49 if test $WAIT != 0 ; then
54 echo "Testing slapd searching..."
55 for i in 0 1 2 3 4 5; do
56 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
57 '(objectclass=*)' > /dev/null 2>&1
59 if test $RC = 1 ; then
60 echo "Waiting 5 seconds for slapd to start..."
65 if test $RC != 0 ; then
66 echo "ldapsearch failed ($RC)!"
71 cat /dev/null > $SEARCHOUT
73 echo "Testing exact searching..."
74 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
75 '(sn=jensen)' >> $SEARCHOUT 2>&1
77 if test $RC != 0 ; then
78 echo "ldapsearch failed ($RC)!"
83 echo "Testing OR searching..."
84 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
85 '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones)(member=cn=Manager,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
87 if test $RC != 0 ; then
88 echo "ldapsearch failed ($RC)!"
93 echo "Testing AND matching and ends-with searching..."
94 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
95 '(&(objectclass=groupofnames)(cn=A*)(member=cn=Mark Elliot,ou=Alumni Association,ou=People,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
97 if test $RC != 0 ; then
98 echo "ldapsearch failed ($RC)!"
103 echo "Testing NOT searching..."
104 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
105 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
107 if test $RC != 0 ; then
108 echo "ldapsearch failed ($RC)!"
113 echo "Testing objectClass/attributeType inheritance ..."
114 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
115 '(&(objectClass=inetorgperson)(userid=uham))' \
116 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
118 if test $RC != 0 ; then
119 echo "ldapsearch failed ($RC)!"
126 LDIF=$SEARCHOUTMASTER
128 echo "Filtering ldapsearch results..."
129 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
130 echo "Filtering original ldif used to create database..."
131 . $LDIFFILTER < $LDIF > $LDIFFLT
132 echo "Comparing filter output..."
133 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
135 if test $? != 0 ; then
136 echo "Comparison failed"
140 echo ">>>>> Test succeeded"