Index: subversion/tests/clients/cmdline/davautocheck.sh =================================================================== --- subversion/tests/clients/cmdline/davautocheck.sh (revision 14285) +++ subversion/tests/clients/cmdline/davautocheck.sh (working copy) @@ -5,7 +5,7 @@ # This script simplifies preparation of environment for Subversion client # communicating with a server via DAV protocol. The prerequisites of such # testing are: -# - Subversion built using --enable-shared --enable-dso --enable-apsx options, +# - Subversion built using --enable-shared --enable-dso --enable-apxs options, # - Working Apache 2 HTTPD Server reachable through PATH, # - Modules dav_module and log_config_module compiled as DSO or built into # Apache HTTPD Server executable. @@ -56,7 +56,7 @@ } function get_loadmodule_config() { - local SO="$HTTPD_REAL_ROOT/libexec/$1.so" + local SO="$($APXS -q LIBEXECDIR)/$1.so" # shared object module? if [ -r "$SO" ]; then @@ -66,11 +66,37 @@ fi # maybe it's built-in? - "$HTTPD" -l | grep -q "$1\\.c" && return + #"$HTTPD" -l | grep -q "$1\\.c" && return + return return 1 } +# Check apxs's SBINDIR and BINDIR for given program names +function get_prog_name() { + for prog in $* + do + for dir in $($APXS -q SBINDIR) $($APXS -q BINDIR) + do + if [ -e "$dir/$prog" ]; then + echo "$dir/$prog" && return + fi + done + done + + return 1 +} + +# Pick up value from Makefile or PATH (also try apxs2 (Debian)) +[ ${APXS:+set} ] \ + || APXS=$(which apxs) \ + || APXS=$(which apxs2) \ + || fail "neither apxs or apxs2 found - required to run davautocheck" + +[ -x $APXS ] || fail "Can't execute apxs executable $APXS" + +say "Using '$APXS'..." + if [ -x svn-config ]; then ABS_BUILDDIR=$(pwd) elif [ -x $SCRIPTDIR/../../../../svn-config ]; then @@ -94,19 +120,20 @@ "$CLIENT_CMD" --version | grep -q '^[*] ra_dav' \ || fail "Subversion client couldn't find and/or load ra_dav library" -HTTPD=$(which httpd 2>/dev/null) \ - || fail "HTTPD executable not found" +httpd="$($APXS -q PROGNAME)" +HTTPD=$(get_prog_name $httpd) || fail "HTTPD not found" +[ -x $HTTPD ] || fail "HTTPD '$HTTPD' not executable" "$HTTPD" -v 1>/dev/null 2>&1 \ - || fail "HTTPD doesn't start properly" + || fail "HTTPD '$HTTPD' doesn't start properly" say "Using '$HTTPD'..." -# need to remove quotes from whatevere 'cut' extracts -root=$("$HTTPD" -V | grep HTTPD_ROOT | cut -d '=' -f 2) -HTTPD_REAL_ROOT=${root//\"/} -[ -d "$HTTPD_REAL_ROOT" ] \ - || fail "HTTPD real root not found" +HTPASSWD=$(get_prog_name htpasswd htpasswd2) \ + || fail "Could not find htpasswd or htpasswd2" +[ -x $HTPASSWD ] \ + || fail "HTPASSWD '$HTPASSWD' not executable" +say "Using '$HTPASSWD'..." LOAD_MOD_DAV=$(get_loadmodule_config mod_dav) \ || fail "DAV module not found" @@ -121,12 +148,17 @@ HTTPD_LOG="$HTTPD_ROOT/log" HTTPD_MIME_TYPES="$HTTPD_ROOT/mime.types" BASE_URL="http://localhost:$HTTPD_PORT" +HTTPD_USERS="$HTTPD_ROOT/users" mkdir "$HTTPD_ROOT" \ || fail "couldn't create temporary directory '$HTTPD_ROOT'" say "Using directory '$HTTPD_ROOT'..." +say "Adding users for lock authentication" +$HTPASSWD -bc $HTTPD_USERS jrandom rayjandom +$HTPASSWD -b $HTTPD_USERS jconstant rayjandom + touch $HTTPD_MIME_TYPES cat > "$HTTPD_CFG" <<__EOF__ @@ -165,10 +197,18 @@ DAV svn SVNParentPath "$ABS_BUILDDIR/subversion/tests/clients/cmdline/repositories" + AuthType Basic + AuthName "Subversion Repository" + AuthUserFile $HTTPD_USERS + Require valid-user DAV svn SVNPath "$ABS_BUILDDIR/subversion/tests/clients/cmdline/local_tmp/repos" + AuthType Basic + AuthName "Subversion Repository" + AuthUserFile $HTTPD_USERS + Require valid-user __EOF__