run.in revision 1.1.1.1
1#!/bin/sh 2# $OpenLDAP: pkg/ldap/tests/run.in,v 1.47.2.6 2008/02/11 23:26:50 kurt Exp $ 3## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4## 5## Copyright 1998-2008 The OpenLDAP Foundation. 6## All rights reserved. 7## 8## Redistribution and use in source and binary forms, with or without 9## modification, are permitted only as authorized by the OpenLDAP 10## Public License. 11## 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>. 15 16USAGE="$0 [-b <backend>] [-c] [-k] [-p] [-u] [-w] <script>" 17 18# configure generated 19SRCDIR="@srcdir@" 20TOPSRCDIR="@top_srcdir@" 21LN_S="@LN_S@" 22EGREP_CMD="@EGREP@" 23 24export SRCDIR TOPSRCDIR LN_S EGREP_CMD 25 26# backends 27AC_bdb=@BUILD_BDB@ 28AC_hdb=@BUILD_HDB@ 29AC_ldap=ldap@BUILD_LDAP@ 30AC_meta=meta@BUILD_META@ 31AC_monitor=@BUILD_MONITOR@ 32AC_relay=relay@BUILD_RELAY@ 33AC_sql=sql@BUILD_SQL@ 34 35# overlays 36AC_accesslog=accesslog@BUILD_ACCESSLOG@ 37AC_dds=dds@BUILD_DDS@ 38AC_dynlist=dynlist@BUILD_DYNLIST@ 39AC_memberof=memberof@BUILD_MEMBEROF@ 40AC_pcache=pcache@BUILD_PROXYCACHE@ 41AC_ppolicy=ppolicy@BUILD_PPOLICY@ 42AC_refint=refint@BUILD_REFINT@ 43AC_retcode=retcode@BUILD_RETCODE@ 44AC_translucent=translucent@BUILD_TRANSLUCENT@ 45AC_unique=unique@BUILD_UNIQUE@ 46AC_rwm=rwm@BUILD_RWM@ 47AC_syncprov=syncprov@BUILD_SYNCPROV@ 48AC_valsort=valsort@BUILD_VALSORT@ 49 50# misc 51AC_WITH_SASL=@WITH_SASL@ 52AC_WITH_TLS=@WITH_TLS@ 53AC_WITH_MODULES_ENABLED=@WITH_MODULES_ENABLED@ 54AC_ACI_ENABLED=aci@WITH_ACI_ENABLED@ 55AC_THREADS=threads@BUILD_THREAD@ 56AC_LIBS_DYNAMIC=lib@BUILD_LIBS_DYNAMIC@ 57 58# sanitize 59if test "${AC_ldap}" = "ldapmod" && test "${AC_LIBS_DYNAMIC}" = "static" ; then 60 AC_ldap="ldapno" 61fi 62if test "${AC_meta}" = "metamod" && test "${AC_LIBS_DYNAMIC}" = "static" ; then 63 AC_meta="metano" 64fi 65 66export AC_bdb AC_hdb AC_ldap AC_meta AC_monitor AC_relay AC_sql \ 67 AC_accesslog AC_dds AC_dynlist AC_memberof AC_pcache AC_ppolicy \ 68 AC_refint AC_retcode AC_rwm AC_unique AC_syncprov AC_translucent \ 69 AC_valsort \ 70 AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED \ 71 AC_THREADS AC_LIBS_DYNAMIC 72 73if test ! -x ../servers/slapd/slapd ; then 74 echo "Could not locate slapd(8)" 75 exit 1 76fi 77 78BACKEND= 79CLEAN=no 80WAIT=0 81KILLSERVERS=yes 82PRESERVE=${PRESERVE-no} 83USERDATA=no 84 85while test $# -gt 0 ; do 86 case "$1" in 87 -b | -backend) 88 BACKEND="$2" 89 shift; shift ;; 90 91 -c | -clean) 92 CLEAN=yes 93 shift ;; 94 95 -k | -kill) 96 KILLSERVERS=no 97 shift ;; 98 99 -p | -preserve) 100 PRESERVE=yes 101 shift ;; 102 103 -u | -userdata) 104 USERDATA=yes 105 shift ;; 106 107 -w | -wait) 108 WAIT=1 109 shift ;; 110 111 -) 112 shift 113 break ;; 114 115 -*) 116 echo "$USAGE"; exit 1 117 ;; 118 119 *) 120 break ;; 121 esac 122done 123 124if test -z "$BACKEND" ; then 125 for b in bdb hdb ; do 126 if eval "test \"\$AC_$b\" != no" ; then 127 BACKEND=$b 128 break 129 fi 130 done 131 if test -z "$BACKEND" ; then 132 echo "No suitable default database backend configured" >&2 133 exit 1 134 fi 135fi 136BACKENDTYPE=`eval 'echo $AC_'$BACKEND` 137if test "x$BACKENDTYPE" = "x" ; then 138 BACKENDTYPE="unknown" 139fi 140export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA 141 142if test $# = 0 ; then 143 echo "$USAGE"; exit 1 144fi 145 146# need defines.sh for the definitions of the directories 147. $SRCDIR/scripts/defines.sh 148 149SCRIPTDIR="${SRCDIR}/scripts" 150SCRIPTNAME="$1" 151shift 152 153if test -x "${SCRIPTDIR}/${SCRIPTNAME}" ; then 154 SCRIPT="${SCRIPTDIR}/${SCRIPTNAME}" 155elif test -x "`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`"; then 156 SCRIPT="`echo ${SCRIPTDIR}/test*-${SCRIPTNAME}`" 157elif test -x "`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`"; then 158 SCRIPT="`echo ${SCRIPTDIR}/${SCRIPTNAME}-*`" 159else 160 echo "run: ${SCRIPTNAME} not found (or not executable)" 161 exit 1; 162fi 163 164if test ! -r ${DATADIR}/test.ldif ; then 165 ${LN_S} ${SRCDIR}/data ${DATADIR} 166fi 167if test ! -r ${SCHEMADIR}/core.schema ; then 168 ${LN_S} ${TOPSRCDIR}/servers/slapd/schema ${SCHEMADIR} 169fi 170 171if test -d ${TESTDIR} ; then 172 if test $PRESERVE = no ; then 173 echo "Cleaning up test run directory leftover from previous run." 174 /bin/rm -rf ${TESTDIR} 175 elif test $PRESERVE = yes ; then 176 echo "Cleaning up only database directories leftover from previous run." 177 /bin/rm -rf ${TESTDIR}/db.* 178 fi 179fi 180mkdir -p ${TESTDIR} 181 182if test $USERDATA = yes ; then 183 if test ! -d userdata ; then 184 echo "User data directory (userdata) does not exist." 185 exit 1 186 fi 187 cp -R userdata/* ${TESTDIR} 188fi 189 190# disable LDAP initialization 191LDAPNOINIT=true; export LDAPNOINIT 192 193echo "Running ${SCRIPT}..." 194$SCRIPT $* 195RC=$? 196 197if test $CLEAN = yes ; then 198 echo "Cleaning up test run directory from this run." 199 /bin/rm -rf ${TESTDIR} 200 echo "Cleaning up symlinks." 201 /bin/rm -f ${DATADIR} ${SCHEMADIR} 202fi 203 204exit $RC 205