3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2005 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 if test $# -eq 0 ; then
17 test -z "$SRCDIR" && SRCDIR="."
21 if test $# -eq 1 ; then
25 echo "running defines.sh $SRCDIR $BACKEND"
26 . $SRCDIR/scripts/defines.sh
28 if test -d "$TESTDIR"; then
29 echo "Cleaning up in $TESTDIR..."
30 /bin/rm -rf testrun/db.*
34 echo "Starting slapd on TCP/IP port $PORT1..."
35 $SLAPD -f $PASSWDCONF -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
37 if test ${WAIT-0} != 0 ; then
43 echo "Testing slapd searching..."
44 for i in 0 1 2 3 4 5; do
45 $LDAPSEARCH -L -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
46 'objectclass=*' > /dev/null 2>&1
48 if test $RC = 1 ; then
49 echo "Waiting 5 seconds for slapd to start..."
54 if test $RC != 0 ; then
55 echo "ldapsearch failed!"
56 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
60 cat /dev/null > $TESTOUT
62 echo "Testing base suffix searching..."
63 $LDAPSEARCH -L -S "" -b "$BASEDN" -s base -h $LOCALHOST -p $PORT1 \
64 '(objectclass=*)' >> $TESTOUT 2>&1
66 if test $RC != 0 ; then
67 echo "ldapsearch failed!"
68 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
72 echo " ------------ " >> $TESTOUT
74 echo "Testing user searching..."
75 $LDAPSEARCH -L -S "" -b "uid=root,$BASEDN" -s base -h $LOCALHOST -p $PORT1 \
76 '(objectclass=*)' >> $TESTOUT 2>&1
78 if test $RC != 0 ; then
79 echo "ldapsearch failed!"
80 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
84 echo " ------------ " >> $TESTOUT
86 echo "Testing exact searching..."
87 $LDAPSEARCH -L -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
88 '(uid=root)' >> $TESTOUT 2>&1
90 if test $RC != 0 ; then
91 echo "ldapsearch failed!"
92 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
96 echo " ------------ " >> $TESTOUT
98 echo "Testing OR searching..."
99 $LDAPSEARCH -L -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
100 '(|(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
102 if test $RC != 0 ; then
103 echo "ldapsearch failed!"
104 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
108 echo " ------------ " >> $TESTOUT
110 echo "Testing AND searching..."
111 $LDAPSEARCH -L -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
112 '(&(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
114 if test $RC != 0 ; then
115 echo "ldapsearch failed!"
116 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
120 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
122 echo "Assuming everything is fine."
123 #echo "Comparing results"
124 #$CMP $TESTOUT $SEARCHOUTMASTER
125 #if test $? != 0 ; then
126 # echo "Comparison failed"
130 echo ">>>>> Test succeeded"