summaryrefslogtreecommitdiffstats
path: root/tests/scripts/test030-relay
blob: 1346ab0090810c621518f8bdb8a4b32f681413e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /bin/sh
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2024 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.

echo "running defines.sh"
. $SRCDIR/scripts/defines.sh

if test $RWM = rwmno ; then 
	echo "rwm (Rewrite/remap) overlay not available, test skipped"
	exit 0
fi 

echo ""

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

	# 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

	# 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

if test "x$RELAYS" = "x" ; then
	echo "no relaying capable backend is available"
	echo ">>>>> Test succeeded"
	exit 0
fi

echo "Testing virtual naming context mapping with $RELAYS backend(s)..."
echo ""

tmpfile=savelog.log
if test -f $tmpfile ; then
	rm -f $tmpfile
fi
first=1
for RELAY in $RELAYS ; do
	if test $first = 1 ; then
		first=0
	else
		echo ">>>>> waiting for things to exit"
		test $KILLSERVERS != no && wait
		echo ""

		mv -f $LOG1 $tmpfile
		rm -rf $TESTDIR
	fi

	mkdir -p $TESTDIR $DBDIR1

	if test -f $tmpfile ; then
		mv $tmpfile $LOG1
	fi

	. $SRCDIR/scripts/relay
done

echo ">>>>> Test succeeded"

test $KILLSERVERS != no && wait

exit 0