]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test030-relay
ITS#3671 must release conn->c_mutex to allow blocked writers to exit
[openldap] / tests / scripts / test030-relay
index bcca7cd500f5a9017412ca085fe7115ca1e081ec..656cc616f91cfc8d7a28538a9d13f918ce3b9d03 100755 (executable)
@@ -2,7 +2,7 @@
 # $OpenLDAP$
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 1998-2004 The OpenLDAP Foundation.
+## Copyright 1998-2005 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
 echo "running defines.sh"
 . $SRCDIR/scripts/defines.sh
 
-if test $BACKRELAY = relayno ; then 
-       echo "relay backend not available, test skipped"
-       exit 0
-fi 
-
 if test $RWM = rwmno ; then 
        echo "Rewrite/remap overlay not available, test skipped"
        exit 0
 fi 
 
-mkdir -p $TESTDIR $DBDIR1
+echo ""
 
-echo "Starting slapd on TCP/IP port $PORT1..."
-. $CONFFILTER $BACKEND $MONITORDB < $RWMCONF > $CONF1
-$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
-PID=$!
-if test $WAIT != 0 ; then
-    echo PID $PID
-    read foo
-fi
-KILLPIDS="$PID"
+if test "x$RELAYS" = "x" ; then
+       RELAYS=
+       # back-relay
+       if test $BACKRELAY = relayno ; then 
+               echo "relay backend not available, test skipped"
+       else
+               if test "x$RELAYS" != "x" ; then
+                       RELAYS="${RELAYS} "
+               fi
+               RELAYS="${RELAYS}relay"
+       fi
 
-echo "Using ldapsearch to check that slapd is running..."
-for i in 0 1 2 3 4 5; do
-       $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
-               'objectclass=*' > /dev/null 2>&1
-       RC=$?
-       if test $RC = 0 ; then
-               break
+       # back-ldap
+       if test $BACKLDAP = ldapno ; then 
+               echo "ldap backend not available, test skipped"
+       else
+               if test "x$RELAYS" != "x" ; then
+                       RELAYS="${RELAYS} "
+               fi
+               RELAYS="${RELAYS}ldap"
        fi
-       echo "Waiting 5 seconds for slapd to start..."
-       sleep 5
-done
-if test $RC != 0 ; then
-       echo "ldapsearch failed $(RC)!"
-       test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
-fi
 
-echo "Using ldapadd to populate the database..."
-$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
-       $LDIFORDERED > $TESTOUT 2>&1
-RC=$?
-if test $RC != 0 ; then
-       echo "ldapadd failed ($RC)!"
-       test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       # back-meta
+       if test $BACKMETA = metano ; then 
+               echo "meta backend not available, test skipped"
+       else
+               if test "x$RELAYS" != "x" ; then
+                       RELAYS="${RELAYS} "
+               fi
+               RELAYS="${RELAYS}meta"
+       fi 
 fi
 
-cat /dev/null > $SEARCHOUT
-
-BASEDN="dc=example,dc=com"
-echo "searching base=\"$BASEDN\"..."
-$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
-RC=$?
-if test $RC != 0 ; then
-       echo "Search failed ($RC)!"
-       test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+if test "x$RELAYS" = "x" ; then
+       echo "no relaying capable backend is available"
+       echo ">>>>> Test succeeded"
+       exit 0
 fi
 
-BASEDN="o=Example,c=US"
-echo "searching base=\"$BASEDN\"..."
-$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
-RC=$?
-if test $RC != 0 ; then
-       echo "Search failed ($RC)!"
-       test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
-fi
+echo "Testing virtual naming context mapping with $RELAYS backend(s)..."
+echo ""
 
-BASEDN="o=Esempio,c=IT"
-echo "searching base=\"$BASEDN\"..."
-$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
-RC=$?
-if test $RC != 0 ; then
-       echo "Search failed ($RC)!"
-       test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
-fi
+first=1
+for RELAY in $RELAYS ; do
+       if test $first = 1 ; then
+               first=0
+       else
+               echo ">>>>> waiting 10 seconds for things to exit"
+               sleep 10
+               echo ""
 
-BASEDN="o=Beispiel,c=DE"
-echo "searching base=\"$BASEDN\"..."
-$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
-RC=$?
-if test $RC != 0 ; then
-       echo "Search failed ($RC)!"
-       test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
-fi
+               rm -rf $TESTDIR
+       fi
+
+       mkdir -p $TESTDIR $DBDIR1
 
-test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       . $SRCDIR/scripts/relay
+done
 
 echo ">>>>> Test succeeded"
 exit 0
+