3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2004 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 USAGE="$0 [-b <backend>] [-c] [-k] [-p] [-u] [-w] <script>"
20 TOPSRCDIR="@top_srcdir@"
23 export SRCDIR TOPSRCDIR LN_S
28 AC_ldap=ldap@BUILD_LDAP@
29 AC_pcache=pcache@BUILD_PROXYCACHE@
30 AC_ppolicy=ppolicy@BUILD_PPOLICY@
31 AC_MONITOR=@BUILD_MONITOR@
32 AC_WITH_TLS=@WITH_TLS@
34 export AC_MONITOR AC_WITH_TLS AC_ldap AC_pcache AC_ppolicy
36 if test ! -x ../servers/slapd/slapd ; then
37 echo "Could not locate slapd(8)"
41 if test $AC_bdb != no ; then
43 elif test $AC_ldbm != no ; then
45 elif test $AC_hdb != no ; then
48 echo "Not configured with a suitable database backend"
55 PRESERVE=${PRESERVE-no}
58 while test $# -gt 0 ; do
97 BACKENDTYPE=`eval 'echo $AC_'$BACKEND`
98 export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA
100 if test $# = 0 ; then
101 echo "$USAGE"; exit 1
104 SCRIPTDIR="${SRCDIR}/scripts"
108 if test -x "${SCRIPTDIR}/${SCRIPTNAME}" ; then
109 SCRIPT="${SCRIPTDIR}/${SCRIPTNAME}"
110 elif test -x "`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"; then
111 SCRIPT="`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"
112 elif test -x "`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"; then
113 SCRIPT="`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"
115 echo "run: ${SCRIPTNAME} not found (or not executable)"
119 if test ! -r testdata/test.ldif ; then
120 ${LN_S} ${SRCDIR}/data testdata
122 if test ! -r schema/core.schema ; then
123 ${LN_S} ${TOPSRCDIR}/servers/slapd/schema schema
125 if test ! -r ucdata/UnicodeData.txt ; then
126 ${LN_S} ../libraries/liblunicode ucdata
129 if test -d testrun ; then
130 if test $PRESERVE = no ; then
131 echo "Cleaning up test run directory leftover from previous run."
133 elif test $PRESERVE = yes ; then
134 echo "Cleaning up only database directories leftover from previous run."
135 /bin/rm -rf testrun/db.*
139 if test $USERDATA = yes ; then
140 if test ! -d userdata ; then
141 echo "User data directory (userdata) does not exist."
145 cp -R userdata/* testrun
148 # disable LDAP initialization
149 LDAPNOINIT=true; export LDAPNOINIT
151 echo "Running ${SCRIPT}..."
155 if test $CLEAN = yes ; then
156 echo "Cleaning up test run directory from this run."
158 echo "Cleaning up symlinks."
159 /bin/rm -f testdata schema ucdata