3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2005 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_meta=meta@BUILD_META@
31 AC_monitor=@BUILD_MONITOR@
32 AC_relay=relay@BUILD_RELAY@
36 AC_glue=glue@BUILD_GLUE@
37 AC_pcache=pcache@BUILD_PROXYCACHE@
38 AC_ppolicy=ppolicy@BUILD_PPOLICY@
39 AC_refint=refint@BUILD_REFINT@
40 AC_retcode=retcode@BUILD_RETCODE@
41 AC_translucent=translucent@BUILD_TRANSLUCENT@
42 AC_unique=unique@BUILD_UNIQUE@
44 AC_syncprov=syncprov@BUILD_SYNCPROV@
47 AC_WITH_SASL=@WITH_SASL@
48 AC_WITH_TLS=@WITH_TLS@
49 AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
50 AC_ACI_ENABLED=aci@SLAPD_ACI_ENABLED@
52 export AC_bdb AC_hdb AC_ldap AC_ldbm AC_meta AC_monitor AC_relay AC_sql
53 export AC_glue AC_pcache AC_ppolicy AC_refint AC_retcode AC_rwm AC_unique AC_syncprov
54 export AC_translucent AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED
56 if test ! -x ../servers/slapd/slapd ; then
57 echo "Could not locate slapd(8)"
61 if test $AC_bdb != no ; then
63 elif test $AC_ldbm != no ; then
65 elif test $AC_hdb != no ; then
68 echo "Not configured with a suitable database backend"
75 PRESERVE=${PRESERVE-no}
78 while test $# -gt 0 ; do
109 echo "$USAGE"; exit 1
117 BACKENDTYPE=`eval 'echo $AC_'$BACKEND`
118 if test "x$BACKENDTYPE" = "x" ; then
119 BACKENDTYPE="unknown"
121 export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA
123 if test $# = 0 ; then
124 echo "$USAGE"; exit 1
127 SCRIPTDIR="${SRCDIR}/scripts"
131 if test -x "${SCRIPTDIR}/${SCRIPTNAME}" ; then
132 SCRIPT="${SCRIPTDIR}/${SCRIPTNAME}"
133 elif test -x "`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"; then
134 SCRIPT="`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"
135 elif test -x "`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"; then
136 SCRIPT="`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"
138 echo "run: ${SCRIPTNAME} not found (or not executable)"
142 if test ! -r testdata/test.ldif ; then
143 ${LN_S} ${SRCDIR}/data testdata
145 if test ! -r schema/core.schema ; then
146 ${LN_S} ${TOPSRCDIR}/servers/slapd/schema schema
149 if test -d testrun ; then
150 if test $PRESERVE = no ; then
151 echo "Cleaning up test run directory leftover from previous run."
153 elif test $PRESERVE = yes ; then
154 echo "Cleaning up only database directories leftover from previous run."
155 /bin/rm -rf testrun/db.*
159 if test $USERDATA = yes ; then
160 if test ! -d userdata ; then
161 echo "User data directory (userdata) does not exist."
165 cp -R userdata/* testrun
168 # disable LDAP initialization
169 LDAPNOINIT=true; export LDAPNOINIT
171 echo "Running ${SCRIPT}..."
175 if test $CLEAN = yes ; then
176 echo "Cleaning up test run directory from this run."
178 echo "Cleaning up symlinks."
179 /bin/rm -f testdata schema