]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test044-dynlist
Sync with HEAD
[openldap] / tests / scripts / test044-dynlist
index 351442d8c14aa66e7f9672113d799ba277c2facd..e1a5487f3b97770458fc6e15c391b0dfa9764188 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 1998-2005 The OpenLDAP Foundation.
+## Copyright 1998-2006 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 $DYNLIST = "dynlistno" ; then 
+       echo "dynlist overlay not available, test skipped"
+       exit 0
+fi 
+
 mkdir -p $TESTDIR $DBDIR1
 
 echo "Running slapadd to build slapd database..."
@@ -26,8 +31,10 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-echo "Running slapindex to index slapd database..."
 . $CONFFILTER $BACKEND $MONITORDB < $DYNLISTCONF > $CONF1
+echo "dynlist-attrset  groupOfURLs memberURL" >> $CONF1
+
+echo "Running slapindex to index slapd database..."
 $SLAPINDEX -f $CONF1
 RC=$?
 if test $RC != 0 ; then
@@ -146,8 +153,36 @@ case $RC in
 0)
        echo "ldapcompare returned success ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit -1
+       ;;
+*)
+       echo "ldapcompare failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
        ;;
+esac
+echo "" >> $SEARCHOUT
+
+echo "Testing list compare (should return FALSE)..."
+echo "# Testing list compare (should return FALSE)..." >> $SEARCHOUT
+$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
+       "cn=Dynamic List,$LISTDN" "cn:FALSE" \
+       >> $SEARCHOUT 2>&1
+RC=$?
+case $RC in
+5)
+       echo "ldapcompare returned FALSE ($RC)"
+       ;;
+6)
+       echo "ldapcompare returned TRUE ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+       ;;
+0)
+       echo "ldapcompare returned success ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit -1
+       ;;
 *)
        echo "ldapcompare failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -156,6 +191,37 @@ case $RC in
 esac
 echo "" >> $SEARCHOUT
 
+echo "Testing list compare (should return UNDEFINED)..."
+echo "# Testing list compare (should return UNDEFINED)..." >> $SEARCHOUT
+$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
+       "cn=Dynamic List,$LISTDN" "dc:UNDEFINED" \
+       >> $SEARCHOUT 2>&1
+RC=$?
+case $RC in
+5)
+       echo "ldapcompare returned FALSE ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+       ;;
+6)
+       echo "ldapcompare returned TRUE ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+       ;;
+16|32)
+       echo "ldapcompare returned UNDEFINED ($RC)"
+       ;;
+0)
+       echo "ldapcompare returned success ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit -1
+       ;;
+*)
+       echo "ldapcompare failed ($RC)"
+       ;;
+esac
+echo "" >> $SEARCHOUT
+
 echo "Testing list compare with manageDSAit..."
 echo "# Testing list compare with manageDSAit..." >> $SEARCHOUT
 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 -MM \
@@ -174,7 +240,7 @@ case $RC in
 0)
        echo "ldapcompare returned success ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit -1
        ;;
 *)
        echo "ldapcompare failed ($RC)!"
@@ -189,10 +255,13 @@ kill -HUP $KILLPIDS
 wait $KILLPIDS
 
 echo "Reconfiguring slapd..."
-echo "dynlist-member-ad        member" >> $CONF1
+. $CONFFILTER $BACKEND $MONITORDB < $DYNLISTCONF > $CONF1
+echo "dynlist-attrset  groupOfURLs memberURL member" >> $CONF1
+
+echo "==========================================================" >> $LOG1
 
 echo "Starting slapd on TCP/IP port $PORT1..."
-$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
 PID=$!
 if test $WAIT != 0 ; then
     echo PID $PID
@@ -281,7 +350,7 @@ CMPDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN"
 echo "Testing list compare..."
 echo "# Testing list compare..." >> $SEARCHOUT
 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
-       "cn=Dynamic List,$LISTDN" "member:$CMPDN" \
+       "cn=Dynamic List of Members,$LISTDN" "member:$CMPDN" \
        >> $SEARCHOUT 2>&1
 RC=$?
 case $RC in
@@ -296,8 +365,36 @@ case $RC in
 0)
        echo "ldapcompare returned success ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit -1
+       ;;
+*)
+       echo "ldapcompare failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
        ;;
+esac
+echo "" >> $SEARCHOUT
+
+echo "Testing list compare (should return FALSE)..."
+echo "# Testing list compare (should return FALSE)..." >> $SEARCHOUT
+$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
+       "cn=Dynamic List of Members,$LISTDN" "member:cn=Foo Bar" \
+       >> $SEARCHOUT 2>&1
+RC=$?
+case $RC in
+5)
+       echo "ldapcompare returned FALSE ($RC)"
+       ;;
+6)
+       echo "ldapcompare returned TRUE ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+       ;;
+0)
+       echo "ldapcompare returned success ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit -1
+       ;;
 *)
        echo "ldapcompare failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -324,7 +421,7 @@ case $RC in
 0)
        echo "ldapcompare returned success ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit -1
        ;;
 *)
        echo "ldapcompare failed ($RC)!"
@@ -351,4 +448,7 @@ if test $? != 0 ; then
 fi
 
 echo ">>>>> Test succeeded"
+
+test $KILLSERVERS != no && wait
+
 exit 0