3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2007 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 $TESTDIR/db.*
34 echo "Starting slapd on TCP/IP port $PORT1..."
35 . $CONFFILTER $BACKEND $MONITORDB < $PASSWDCONF > $CONF1
36 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
38 if test ${WAIT-0} != 0 ; then
44 echo "Testing slapd searching..."
45 for i in 0 1 2 3 4 5; do
46 $LDAPSEARCH -L -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
47 'objectclass=*' > /dev/null 2>&1
49 if test $RC = 1 ; then
50 echo "Waiting 5 seconds for slapd to start..."
55 if test $RC != 0 ; then
56 echo "ldapsearch failed!"
57 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
61 cat /dev/null > $TESTOUT
63 echo "Testing base suffix searching..."
64 $LDAPSEARCH -L -S "" -b "$BASEDN" -s base -h $LOCALHOST -p $PORT1 \
65 '(objectclass=*)' >> $TESTOUT 2>&1
67 if test $RC != 0 ; then
68 echo "ldapsearch failed!"
69 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
73 echo " ------------ " >> $TESTOUT
75 echo "Testing user searching..."
76 $LDAPSEARCH -L -S "" -b "uid=root,$BASEDN" -s base -h $LOCALHOST -p $PORT1 \
77 '(objectclass=*)' >> $TESTOUT 2>&1
79 if test $RC != 0 ; then
80 echo "ldapsearch failed!"
81 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
85 echo " ------------ " >> $TESTOUT
87 echo "Testing exact searching..."
88 $LDAPSEARCH -L -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
89 '(uid=root)' >> $TESTOUT 2>&1
91 if test $RC != 0 ; then
92 echo "ldapsearch failed!"
93 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
97 echo " ------------ " >> $TESTOUT
99 echo "Testing OR searching..."
100 $LDAPSEARCH -L -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
101 '(|(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
103 if test $RC != 0 ; then
104 echo "ldapsearch failed!"
105 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
109 echo " ------------ " >> $TESTOUT
111 echo "Testing AND searching..."
112 $LDAPSEARCH -L -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
113 '(&(objectclass=person)(cn=root))' >> $TESTOUT 2>&1
115 if test $RC != 0 ; then
116 echo "ldapsearch failed!"
117 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
121 test "$KILLSERVERS" != no && kill -HUP $KILLPIDS
123 echo "Assuming everything is fine."
124 #echo "Comparing results"
125 #$CMP $TESTOUT $SEARCHOUTMASTER
126 #if test $? != 0 ; then
127 # echo "Comparison failed"
131 echo ">>>>> Test succeeded"