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@
30 AC_monitor=@BUILD_MONITOR@
31 AC_relay=relay@BUILD_RELAY@
35 AC_pcache=pcache@BUILD_PROXYCACHE@
36 AC_ppolicy=ppolicy@BUILD_PPOLICY@
37 AC_refint=refint@BUILD_REFINT@
38 AC_unique=unique@BUILD_UNIQUE@
42 AC_WITH_SASL=@WITH_SASL@
43 AC_WITH_TLS=@WITH_TLS@
44 AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
46 export AC_bdb AC_hdb AC_ldap AC_ldbm AC_monitor AC_relay AC_sql
47 export AC_pcache AC_ppolicy AC_refint AC_unique AC_rwm
48 export AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED
50 if test ! -x ../servers/slapd/slapd ; then
51 echo "Could not locate slapd(8)"
55 if test $AC_bdb != no ; then
57 elif test $AC_ldbm != no ; then
59 elif test $AC_hdb != no ; then
62 echo "Not configured with a suitable database backend"
69 PRESERVE=${PRESERVE-no}
72 while test $# -gt 0 ; do
103 echo "$USAGE"; exit 1
111 BACKENDTYPE=`eval 'echo $AC_'$BACKEND`
112 export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA
114 if test $# = 0 ; then
115 echo "$USAGE"; exit 1
118 SCRIPTDIR="${SRCDIR}/scripts"
122 if test -x "${SCRIPTDIR}/${SCRIPTNAME}" ; then
123 SCRIPT="${SCRIPTDIR}/${SCRIPTNAME}"
124 elif test -x "`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"; then
125 SCRIPT="`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"
126 elif test -x "`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"; then
127 SCRIPT="`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"
129 echo "run: ${SCRIPTNAME} not found (or not executable)"
133 if test ! -r testdata/test.ldif ; then
134 ${LN_S} ${SRCDIR}/data testdata
136 if test ! -r schema/core.schema ; then
137 ${LN_S} ${TOPSRCDIR}/servers/slapd/schema schema
140 if test -d testrun ; then
141 if test $PRESERVE = no ; then
142 echo "Cleaning up test run directory leftover from previous run."
144 elif test $PRESERVE = yes ; then
145 echo "Cleaning up only database directories leftover from previous run."
146 /bin/rm -rf testrun/db.*
150 if test $USERDATA = yes ; then
151 if test ! -d userdata ; then
152 echo "User data directory (userdata) does not exist."
156 cp -R userdata/* testrun
159 # disable LDAP initialization
160 LDAPNOINIT=true; export LDAPNOINIT
162 echo "Running ${SCRIPT}..."
166 if test $CLEAN = yes ; then
167 echo "Cleaning up test run directory from this run."
169 echo "Cleaning up symlinks."
170 /bin/rm -f testdata schema