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_refint=refint@BUILD_REFINT@
32 AC_unique=unique@BUILD_UNIQUE@
33 AC_MONITOR=@BUILD_MONITOR@
34 AC_WITH_SASL=@WITH_SASL@
35 AC_WITH_TLS=@WITH_TLS@
37 export AC_MONITOR AC_WITH_SASL AC_WITH_TLS AC_ldap AC_pcache AC_ppolicy
38 export AC_refint AC_unique
40 if test ! -x ../servers/slapd/slapd ; then
41 echo "Could not locate slapd(8)"
45 if test $AC_bdb != no ; then
47 elif test $AC_ldbm != no ; then
49 elif test $AC_hdb != no ; then
52 echo "Not configured with a suitable database backend"
59 PRESERVE=${PRESERVE-no}
62 while test $# -gt 0 ; do
101 BACKENDTYPE=`eval 'echo $AC_'$BACKEND`
102 export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA
104 if test $# = 0 ; then
105 echo "$USAGE"; exit 1
108 SCRIPTDIR="${SRCDIR}/scripts"
112 if test -x "${SCRIPTDIR}/${SCRIPTNAME}" ; then
113 SCRIPT="${SCRIPTDIR}/${SCRIPTNAME}"
114 elif test -x "`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"; then
115 SCRIPT="`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"
116 elif test -x "`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"; then
117 SCRIPT="`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"
119 echo "run: ${SCRIPTNAME} not found (or not executable)"
123 if test ! -r testdata/test.ldif ; then
124 ${LN_S} ${SRCDIR}/data testdata
126 if test ! -r schema/core.schema ; then
127 ${LN_S} ${TOPSRCDIR}/servers/slapd/schema schema
130 if test -d testrun ; then
131 if test $PRESERVE = no ; then
132 echo "Cleaning up test run directory leftover from previous run."
134 elif test $PRESERVE = yes ; then
135 echo "Cleaning up only database directories leftover from previous run."
136 /bin/rm -rf testrun/db.*
140 if test $USERDATA = yes ; then
141 if test ! -d userdata ; then
142 echo "User data directory (userdata) does not exist."
146 cp -R userdata/* testrun
149 # disable LDAP initialization
150 LDAPNOINIT=true; export LDAPNOINIT
152 echo "Running ${SCRIPT}..."
156 if test $CLEAN = yes ; then
157 echo "Cleaning up test run directory from this run."
159 echo "Cleaning up symlinks."
160 /bin/rm -f testdata schema