]> git.sur5r.net Git - openldap/blob - tests/scripts/test030-relay
407f75dd707a74b5fe060b73ad3c90b5d7856744
[openldap] / tests / scripts / test030-relay
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2018 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
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>.
15
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
18
19 if test $RWM = rwmno ; then 
20         echo "rwm (Rewrite/remap) overlay not available, test skipped"
21         exit 0
22 fi 
23
24 echo ""
25
26 if test "x$RELAYS" = "x" ; then
27         RELAYS=
28         # back-relay
29         if test $BACKRELAY = relayno ; then 
30                 echo "relay backend not available, test skipped"
31         else
32                 if test "x$RELAYS" != "x" ; then
33                         RELAYS="${RELAYS} "
34                 fi
35                 RELAYS="${RELAYS}relay"
36         fi
37
38         # back-ldap
39         if test $BACKLDAP = ldapno ; then 
40                 echo "ldap backend not available, test skipped"
41         else
42                 if test $THREADS = "threadsno" ; then
43                         echo "Need threads support, test skipped"
44                 else
45                         if test "x$RELAYS" != "x" ; then
46                                 RELAYS="${RELAYS} "
47                         fi
48                         RELAYS="${RELAYS}ldap"
49                 fi 
50         fi
51
52         # back-meta
53         if test $BACKMETA = metano ; then 
54                 echo "meta backend not available, test skipped"
55         else
56                 if test $THREADS = "threadsno" ; then
57                         echo "Need threads support, test skipped"
58                 else
59                         if test "x$RELAYS" != "x" ; then
60                                 RELAYS="${RELAYS} "
61                         fi
62                         RELAYS="${RELAYS}meta"
63                 fi
64         fi 
65 fi
66
67 if test "x$RELAYS" = "x" ; then
68         echo "no relaying capable backend is available"
69         echo ">>>>> Test succeeded"
70         exit 0
71 fi
72
73 echo "Testing virtual naming context mapping with $RELAYS backend(s)..."
74 echo ""
75
76 tmpfile=savelog.log
77 if test -f $tmpfile ; then
78         rm -f $tmpfile
79 fi
80 first=1
81 for RELAY in $RELAYS ; do
82         RUNIT=yes
83         if test $THREADS = "threadsno" ; then
84                 case $RELAY in
85                 ldap|meta)
86                         echo "Need threads support, test skipped"
87                         RUNIT=no
88                         ;;
89                 esac
90         fi
91         
92         if test $RUNIT = yes ; then             
93                 if test $first = 1 ; then
94                         first=0
95                 else
96                         echo ">>>>> waiting for things to exit"
97                         test $KILLSERVERS != no && wait
98                         echo ""
99
100                         mv -f $LOG1 $tmpfile
101                         rm -rf $TESTDIR
102                 fi
103
104                 mkdir -p $TESTDIR $DBDIR1
105
106                 if test -f $tmpfile ; then
107                         mv $tmpfile $LOG1
108                 fi
109         
110                 . $SRCDIR/scripts/relay
111         fi
112 done
113
114 echo ">>>>> Test succeeded"
115
116 test $KILLSERVERS != no && wait
117
118 exit 0