3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 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@"
24 export SRCDIR TOPSRCDIR LN_S EGREP_CMD
29 AC_ldap=ldap@BUILD_LDAP@
30 AC_meta=meta@BUILD_META@
31 AC_monitor=@BUILD_MONITOR@
32 AC_relay=relay@BUILD_RELAY@
36 AC_accesslog=accesslog@BUILD_ACCESSLOG@
38 AC_dynlist=dynlist@BUILD_DYNLIST@
39 AC_pcache=pcache@BUILD_PROXYCACHE@
40 AC_ppolicy=ppolicy@BUILD_PPOLICY@
41 AC_refint=refint@BUILD_REFINT@
42 AC_retcode=retcode@BUILD_RETCODE@
43 AC_translucent=translucent@BUILD_TRANSLUCENT@
44 AC_unique=unique@BUILD_UNIQUE@
46 AC_syncprov=syncprov@BUILD_SYNCPROV@
47 AC_valsort=valsort@BUILD_VALSORT@
50 AC_WITH_SASL=@WITH_SASL@
51 AC_WITH_TLS=@WITH_TLS@
52 AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@
53 AC_ACI_ENABLED=aci@WITH_ACI_ENABLED@
54 AC_THREADS=threads@BUILD_THREAD@
56 export AC_bdb AC_hdb AC_ldap AC_meta AC_monitor AC_relay AC_sql \
57 AC_accesslog AC_dynlist AC_pcache AC_ppolicy AC_refint AC_retcode \
58 AC_rwm AC_unique AC_syncprov AC_translucent AC_valsort \
60 AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED \
63 if test ! -x ../servers/slapd/slapd ; then
64 echo "Could not locate slapd(8)"
72 PRESERVE=${PRESERVE-no}
75 while test $# -gt 0 ; do
106 echo "$USAGE"; exit 1
114 if test -z "$BACKEND" ; then
115 for b in bdb hdb ; do
116 if eval "test \"\$AC_$b\" != no" ; then
121 if test -z "$BACKEND" ; then
122 echo "No suitable default database backend configured" >&2
126 BACKENDTYPE=`eval 'echo $AC_'$BACKEND`
127 if test "x$BACKENDTYPE" = "x" ; then
128 BACKENDTYPE="unknown"
130 export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA
132 if test $# = 0 ; then
133 echo "$USAGE"; exit 1
136 # need defines.sh for the definitions of the directories
137 . $SRCDIR/scripts/defines.sh
139 SCRIPTDIR="${SRCDIR}/scripts"
143 if test -x "${SCRIPTDIR}/${SCRIPTNAME}" ; then
144 SCRIPT="${SCRIPTDIR}/${SCRIPTNAME}"
145 elif test -x "`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"; then
146 SCRIPT="`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"
147 elif test -x "`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"; then
148 SCRIPT="`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"
150 echo "run: ${SCRIPTNAME} not found (or not executable)"
154 if test ! -r ${DATADIR}/test.ldif ; then
155 ${LN_S} ${SRCDIR}/data ${DATADIR}
157 if test ! -r ${SCHEMADIR}/core.schema ; then
158 ${LN_S} ${TOPSRCDIR}/servers/slapd/schema ${SCHEMADIR}
161 if test -d ${TESTDIR} ; then
162 if test $PRESERVE = no ; then
163 echo "Cleaning up test run directory leftover from previous run."
164 /bin/rm -rf ${TESTDIR}
165 elif test $PRESERVE = yes ; then
166 echo "Cleaning up only database directories leftover from previous run."
167 /bin/rm -rf ${TESTDIR}/db.*
171 if test $USERDATA = yes ; then
172 if test ! -d userdata ; then
173 echo "User data directory (userdata) does not exist."
177 cp -R userdata/* ${TESTDIR}
180 # disable LDAP initialization
181 LDAPNOINIT=true; export LDAPNOINIT
183 echo "Running ${SCRIPT}..."
187 if test $CLEAN = yes ; then
188 echo "Cleaning up test run directory from this run."
189 /bin/rm -rf ${TESTDIR}
190 echo "Cleaning up symlinks."
191 /bin/rm -f ${DATADIR} ${SCHEMADIR}