~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/davautocheck.sh

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
# This script simplifies preparation of environment for Subversion client
26
26
# communicating with a server via DAV protocol. The prerequisites of such
27
27
# testing are:
28
 
#   - Subversion built using --enable-shared --enable-dso --with-apxs options,
 
28
#   - Subversion built using --enable-shared --with-apxs options,
29
29
#   - Working Apache 2 HTTPD Server with the apxs program reachable through
30
30
#     PATH or specified via the APXS Makefile variable or environment variable,
31
31
#   - Modules dav_module and log_config_module compiled as DSO or built into
62
62
# one version's client against another version's server) specify both APXS
63
63
# *and* MODULE_PATH for the other server:
64
64
#
65
 
#   APXS=/opt/svn/1.4.x/bin/apxs MODULE_PATH=/opt/svn/1.4.x/modules \ 
 
65
#   APXS=/opt/svn/1.4.x/bin/apxs MODULE_PATH=/opt/svn/1.4.x/modules \
66
66
#     subversion/tests/cmdline/davautocheck.sh
67
67
#
68
68
# To prevent the server from advertising httpv2, pass USE_HTTPV1 in
71
71
# To enable "SVNCacheRevProps on" set CACHE_REVPROPS in the environment.
72
72
#
73
73
# To test over https set USE_SSL in the environment.
74
 
 
74
#
75
75
# To use value for "SVNPathAuthz" directive set SVN_PATH_AUTHZ with
76
76
# appropriate value in the environment.
77
77
#
79
79
# environment.
80
80
#
81
81
# Passing --no-tests as argv[1] will have the script start a server
82
 
# but not run any tests.
 
82
# but not run any tests.  Passing --gdb will do the same, and in addition
 
83
# spawn gdb in the foreground attached to the running server.
83
84
 
84
85
PYTHON=${PYTHON:-python}
85
86
 
86
87
SCRIPTDIR=$(dirname $0)
87
88
SCRIPT=$(basename $0)
 
89
STOPSCRIPT=$SCRIPTDIR/.$SCRIPT.stop
88
90
 
89
91
trap stop_httpd_and_die HUP TERM INT
90
92
 
112
114
  if [ -n "$BASH_VERSION" ]; then
113
115
    read -n 1 -t 32
114
116
  else
115
 
    # 
116
 
    prog=$(cat) <<'EOF'
 
117
    #
 
118
    prog="
117
119
import select as s
118
120
import sys
 
121
import tty, termios
 
122
tty.setcbreak(sys.stdin.fileno(), termios.TCSANOW)
119
123
if s.select([sys.stdin.fileno()], [], [], 32)[0]:
120
124
  sys.stdout.write(sys.stdin.read(1))
121
 
EOF
122
 
    REPLY=`stty cbreak; $PYTHON -c "$prog" "$@"; stty -cbreak`
 
125
"
 
126
    stty_state=`stty -g`
 
127
    REPLY=`$PYTHON -u -c "$prog" "$@"`
 
128
    stty $stty_state
123
129
  fi
124
130
  echo
125
131
  [ "${REPLY:-$2}" = 'y' ]
136
142
  fi
137
143
 
138
144
  # maybe it's built-in?
139
 
  "$HTTPD" -l | grep -q "$1\\.c" && return
 
145
  "$HTTPD" -l | grep "$1\\.c" >/dev/null && return
140
146
 
141
147
  return 1
142
148
}
157
163
}
158
164
 
159
165
# Don't assume sbin is in the PATH.
 
166
# ### Presumably this is used to locate /usr/sbin/apxs or /usr/sbin/apache2
160
167
PATH="$PATH:/usr/sbin:/usr/local/sbin"
161
168
 
162
169
# Find the source and build directories. The build dir can be found if it is
217
224
if [ ${MODULE_PATH:+set} ]; then
218
225
    MOD_DAV_SVN="$MODULE_PATH/mod_dav_svn.so"
219
226
    MOD_AUTHZ_SVN="$MODULE_PATH/mod_authz_svn.so"
 
227
    MOD_DONTDOTHAT="$MODULE_PATH/mod_dontdothat.so"
220
228
else
221
229
    MOD_DAV_SVN="$ABS_BUILDDIR/subversion/mod_dav_svn/.libs/mod_dav_svn.so"
222
230
    MOD_AUTHZ_SVN="$ABS_BUILDDIR/subversion/mod_authz_svn/.libs/mod_authz_svn.so"
 
231
    MOD_DONTDOTHAT="$ABS_BUILDDIR/tools/server-side/mod_dontdothat/.libs/mod_dontdothat.so"
223
232
fi
224
233
 
225
234
[ -r "$MOD_DAV_SVN" ] \
226
 
  || fail "dav_svn_module not found, please use '--enable-shared --enable-dso --with-apxs' with your 'configure' script"
 
235
  || fail "dav_svn_module not found, please use '--enable-shared --with-apxs' with your 'configure' script"
227
236
[ -r "$MOD_AUTHZ_SVN" ] \
228
 
  || fail "authz_svn_module not found, please use '--enable-shared --enable-dso --with-apxs' with your 'configure' script"
 
237
  || fail "authz_svn_module not found, please use '--enable-shared --with-apxs' with your 'configure' script"
 
238
[ -r "$MOD_DONTDOTHAT" ] \
 
239
  || fail "dontdothat_module not found, please use '--enable-shared --with-apxs' with your 'configure' script"
229
240
 
230
241
for d in "$ABS_BUILDDIR"/subversion/*/.libs; do
231
242
  if [ -z "$BUILDDIR_LIBRARY_PATH" ]; then
237
248
 
238
249
case "`uname`" in
239
250
  Darwin*)
240
 
    LDD='otool -L'
241
251
    DYLD_LIBRARY_PATH="$BUILDDIR_LIBRARY_PATH:$DYLD_LIBRARY_PATH"
242
252
    export DYLD_LIBRARY_PATH
243
253
    ;;
244
254
  *)
245
 
    LDD='ldd'
246
255
    LD_LIBRARY_PATH="$BUILDDIR_LIBRARY_PATH:$LD_LIBRARY_PATH"
247
256
    export LD_LIBRARY_PATH
248
257
    ;;
255
264
"$HTTPD" -v 1>/dev/null 2>&1 \
256
265
  || fail "HTTPD '$HTTPD' doesn't start properly"
257
266
 
258
 
say "Using '$HTTPD'..."
259
 
 
260
267
HTPASSWD=$(get_prog_name htpasswd htpasswd2) \
261
268
  || fail "Could not find htpasswd or htpasswd2"
262
269
[ -x $HTPASSWD ] \
289
296
    || fail "Authn_Core module not found."
290
297
LOAD_MOD_AUTHZ_CORE="$(get_loadmodule_config mod_authz_core)" \
291
298
    || fail "Authz_Core module not found."
292
 
LOAD_MOD_AUTHZ_HOST="$(get_loadmodule_config mod_authz_host)" \
293
 
    || fail "Authz_Host module not found."
294
299
LOAD_MOD_UNIXD=$(get_loadmodule_config mod_unixd) \
295
300
    || fail "UnixD module not found"
296
301
}
298
303
    || fail "Authn_File module not found."
299
304
LOAD_MOD_AUTHZ_USER="$(get_loadmodule_config mod_authz_user)" \
300
305
    || fail "Authz_User module not found."
 
306
LOAD_MOD_AUTHZ_GROUPFILE="$(get_loadmodule_config mod_authz_groupfile)" \
 
307
    || fail "Authz_GroupFile module not found."
 
308
LOAD_MOD_AUTHZ_HOST="$(get_loadmodule_config mod_authz_host)" \
 
309
    || fail "Authz_Host module not found."
301
310
}
302
311
if [ ${APACHE_MPM:+set} ]; then
303
312
    LOAD_MOD_MPM=$(get_loadmodule_config mod_mpm_$APACHE_MPM) \
308
317
      || fail "SSL module not found"
309
318
fi
310
319
 
311
 
random_port() {
312
 
  if [ -n "$BASH_VERSION" ]; then
313
 
    echo $(($RANDOM+1024))
314
 
  else
315
 
    $PYTHON -c 'import random; print random.randint(1024, 2**16-1)'
 
320
# Stop any previous instances, os we can re-use the port.
 
321
if [ -x $STOPSCRIPT ]; then $STOPSCRIPT ; sleep 1; fi
 
322
 
 
323
HTTPD_PORT=3691
 
324
while netstat -an | grep $HTTPD_PORT | grep 'LISTEN' >/dev/null; do
 
325
  HTTPD_PORT=$(( HTTPD_PORT + 1 ))
 
326
  if [ $HTTPD_PORT -eq 65536 ]; then
 
327
    # Most likely the loop condition is true regardless of $HTTPD_PORT
 
328
    fail "netstat claims you have no free ports for httpd to listen on."
316
329
  fi
317
 
}
318
 
 
319
 
HTTPD_PORT=$(random_port)
320
 
while netstat -an | grep $HTTPD_PORT | grep 'LISTEN'; do
321
 
  HTTPD_PORT=$(random_port)
322
330
done
323
331
HTTPD_ROOT="$ABS_BUILDDIR/subversion/tests/cmdline/httpd-$(date '+%Y%m%d-%H%M%S')"
324
332
HTTPD_CFG="$HTTPD_ROOT/cfg"
326
334
HTTPD_ACCESS_LOG="$HTTPD_ROOT/access_log"
327
335
HTTPD_ERROR_LOG="$HTTPD_ROOT/error_log"
328
336
HTTPD_MIME_TYPES="$HTTPD_ROOT/mime.types"
329
 
BASE_URL="http://localhost:$HTTPD_PORT"
 
337
HTTPD_DONTDOTHAT="$HTTPD_ROOT/dontdothat"
 
338
if [ -z "$BASE_URL" ]; then
 
339
  BASE_URL="http://localhost:$HTTPD_PORT"
 
340
else
 
341
  # Specify the public name of the host when using a proxy on another host, the
 
342
  # port number will be appended.
 
343
  BASE_URL="$BASE_URL:$HTTPD_PORT"
 
344
fi
330
345
HTTPD_USERS="$HTTPD_ROOT/users"
 
346
HTTPD_GROUPS="$HTTPD_ROOT/groups"
331
347
 
332
348
mkdir "$HTTPD_ROOT" \
333
349
  || fail "couldn't create temporary directory '$HTTPD_ROOT'"
388
404
say "Adding users for lock authentication"
389
405
$HTPASSWD -bc $HTTPD_USERS jrandom   rayjandom
390
406
$HTPASSWD -b  $HTTPD_USERS jconstant rayjandom
 
407
$HTPASSWD -b  $HTTPD_USERS __dumpster__ __loadster__
 
408
$HTPASSWD -b  $HTTPD_USERS JRANDOM   rayjandom
 
409
$HTPASSWD -b  $HTTPD_USERS JCONSTANT rayjandom
 
410
 
 
411
say "Adding groups for mod_authz_svn tests"
 
412
cat > "$HTTPD_GROUPS" <<__EOF__
 
413
random: jrandom
 
414
constant: jconstant
 
415
__EOF__
391
416
 
392
417
touch $HTTPD_MIME_TYPES
393
418
 
 
419
cat >  "$HTTPD_DONTDOTHAT" <<__EOF__
 
420
[recursive-actions]
 
421
/ = deny
 
422
 
 
423
__EOF__
 
424
 
394
425
cat > "$HTTPD_CFG" <<__EOF__
395
426
$LOAD_MOD_MPM
396
427
$LOAD_MOD_SSL
405
436
$LOAD_MOD_AUTHN_FILE
406
437
$LOAD_MOD_AUTHZ_CORE
407
438
$LOAD_MOD_AUTHZ_USER
 
439
$LOAD_MOD_AUTHZ_GROUPFILE
408
440
$LOAD_MOD_AUTHZ_HOST
 
441
$LOAD_MOD_ACCESS_COMPAT
409
442
LoadModule          authz_svn_module "$MOD_AUTHZ_SVN"
 
443
LoadModule          dontdothat_module "$MOD_DONTDOTHAT"
410
444
 
411
445
__EOF__
412
446
 
443
477
Listen              $HTTPD_PORT
444
478
ServerName          localhost
445
479
PidFile             "$HTTPD_PID"
446
 
LogFormat           "%h %l %u %t \"%r\" %>s %b" common
 
480
LogFormat           "%h %l %u %t \"%r\" %>s %b \"%f\"" common
447
481
CustomLog           "$HTTPD_ACCESS_LOG" common
448
482
ErrorLog            "$HTTPD_ERROR_LOG"
449
 
LogLevel            Debug
 
483
LogLevel            debug
450
484
ServerRoot          "$HTTPD_ROOT"
451
485
DocumentRoot        "$HTTPD_ROOT"
452
486
ScoreBoardFile      "$HTTPD_ROOT/run"
486
520
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
487
521
  ${SVN_PATH_AUTHZ_LINE}
488
522
</Location>
 
523
<Location /ddt-test-work/repositories>
 
524
  DAV               svn
 
525
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/repositories"
 
526
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
527
  AuthType          Basic
 
528
  AuthName          "Subversion Repository"
 
529
  AuthUserFile      $HTTPD_USERS
 
530
  Require           valid-user
 
531
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
532
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
533
  ${SVN_PATH_AUTHZ_LINE}
 
534
  DontDoThatConfigFile "$HTTPD_DONTDOTHAT"
 
535
</Location>
489
536
<Location /svn-test-work/local_tmp/repos>
490
537
  DAV               svn
491
538
  SVNPath           "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp/repos"
497
544
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
498
545
  ${SVN_PATH_AUTHZ_LINE}
499
546
</Location>
 
547
<Location /authz-test-work/anon>
 
548
  DAV               svn
 
549
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
550
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
551
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
552
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
553
  SVNListParentPath On
 
554
  # This may seem unnecessary but granting access to everyone here is necessary
 
555
  # to exercise a bug with httpd 2.3.x+.  The "Require all granted" syntax is
 
556
  # new to 2.3.x+ which we can detect with the mod_authz_core.c module
 
557
  # signature.  Use the "Allow from all" syntax with older versions for symmetry.
 
558
  <IfModule mod_authz_core.c>
 
559
    Require all granted
 
560
  </IfModule>
 
561
  <IfModule !mod_authz_core.c>
 
562
    Allow from all
 
563
  </IfMOdule>
 
564
  ${SVN_PATH_AUTHZ_LINE}
 
565
</Location>
 
566
<Location /authz-test-work/mixed>
 
567
  DAV               svn
 
568
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
569
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
570
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
571
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
572
  SVNListParentPath On
 
573
  AuthType          Basic
 
574
  AuthName          "Subversion Repository"
 
575
  AuthUserFile      $HTTPD_USERS
 
576
  Require           valid-user
 
577
  Satisfy Any
 
578
  ${SVN_PATH_AUTHZ_LINE}
 
579
</Location>
 
580
<Location /authz-test-work/mixed-noauthwhenanon>
 
581
  DAV               svn
 
582
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
583
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
584
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
585
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
586
  SVNListParentPath On
 
587
  AuthType          Basic
 
588
  AuthName          "Subversion Repository"
 
589
  AuthUserFile      $HTTPD_USERS
 
590
  Require           valid-user
 
591
  AuthzSVNNoAuthWhenAnonymousAllowed On
 
592
  SVNPathAuthz      On
 
593
</Location>
 
594
<Location /authz-test-work/authn>
 
595
  DAV               svn
 
596
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
597
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
598
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
599
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
600
  SVNListParentPath On
 
601
  AuthType          Basic
 
602
  AuthName          "Subversion Repository"
 
603
  AuthUserFile      $HTTPD_USERS
 
604
  Require           valid-user
 
605
  ${SVN_PATH_AUTHZ_LINE}
 
606
</Location>
 
607
<Location /authz-test-work/authn-anonoff>
 
608
  DAV               svn
 
609
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
610
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
611
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
612
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
613
  SVNListParentPath On
 
614
  AuthType          Basic
 
615
  AuthName          "Subversion Repository"
 
616
  AuthUserFile      $HTTPD_USERS
 
617
  Require           valid-user
 
618
  AuthzSVNAnonymous Off
 
619
  SVNPathAuthz      On
 
620
</Location>
 
621
<Location /authz-test-work/authn-lcuser>
 
622
  DAV               svn
 
623
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
624
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
625
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
626
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
627
  SVNListParentPath On
 
628
  AuthType          Basic
 
629
  AuthName          "Subversion Repository"
 
630
  AuthUserFile      $HTTPD_USERS
 
631
  Require           valid-user
 
632
  AuthzForceUsernameCase Lower
 
633
  ${SVN_PATH_AUTHZ_LINE}
 
634
</Location>
 
635
<Location /authz-test-work/authn-lcuser>
 
636
  DAV               svn
 
637
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
638
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
639
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
640
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
641
  SVNListParentPath On
 
642
  AuthType          Basic
 
643
  AuthName          "Subversion Repository"
 
644
  AuthUserFile      $HTTPD_USERS
 
645
  Require           valid-user
 
646
  AuthzForceUsernameCase Lower
 
647
  ${SVN_PATH_AUTHZ_LINE}
 
648
</Location>
 
649
<Location /authz-test-work/authn-group>
 
650
  DAV               svn
 
651
  SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
652
  AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
653
  SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
654
  SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
655
  SVNListParentPath On
 
656
  AuthType          Basic
 
657
  AuthName          "Subversion Repository"
 
658
  AuthUserFile      $HTTPD_USERS
 
659
  AuthGroupFile     $HTTPD_GROUPS
 
660
  Require           group random
 
661
  AuthzSVNAuthoritative Off
 
662
  SVNPathAuthz      On
 
663
</Location>
 
664
<IfModule mod_authz_core.c>
 
665
  <Location /authz-test-work/sallrany>
 
666
    DAV               svn
 
667
    SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
668
    AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
669
    SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
670
    SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
671
    SVNListParentPath On
 
672
    AuthType          Basic
 
673
    AuthName          "Subversion Repository"
 
674
    AuthUserFile      $HTTPD_USERS
 
675
    AuthzSendForbiddenOnFailure On
 
676
    Satisfy All
 
677
    <RequireAny>
 
678
      Require valid-user
 
679
      Require expr req('ALLOW') == '1'
 
680
    </RequireAny>
 
681
    ${SVN_PATH_AUTHZ_LINE}
 
682
  </Location>
 
683
  <Location /authz-test-work/sallrall>
 
684
    DAV               svn
 
685
    SVNParentPath     "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/local_tmp"
 
686
    AuthzSVNAccessFile "$ABS_BUILDDIR/subversion/tests/cmdline/svn-test-work/authz"
 
687
    SVNAdvertiseV2Protocol ${ADVERTISE_V2_PROTOCOL}
 
688
    SVNCacheRevProps  ${CACHE_REVPROPS_SETTING}
 
689
    SVNListParentPath On
 
690
    AuthType          Basic
 
691
    AuthName          "Subversion Repository"
 
692
    AuthUserFile      $HTTPD_USERS
 
693
    AuthzSendForbiddenOnFailure On
 
694
    Satisfy All
 
695
    <RequireAll>
 
696
      Require valid-user
 
697
      Require expr req('ALLOW') == '1'
 
698
    </RequireAll>
 
699
    ${SVN_PATH_AUTHZ_LINE}
 
700
  </Location>
 
701
</IfModule>
500
702
RedirectMatch permanent ^/svn-test-work/repositories/REDIRECT-PERM-(.*)\$ /svn-test-work/repositories/\$1
501
703
RedirectMatch           ^/svn-test-work/repositories/REDIRECT-TEMP-(.*)\$ /svn-test-work/repositories/\$1
502
704
__EOF__
503
705
 
504
706
START="$HTTPD -f $HTTPD_CFG"
 
707
printf \
 
708
'#!/bin/sh
 
709
if [ -d "%s" ]; then
 
710
  printf "Stopping previous HTTPD instance..."
 
711
  if %s -k stop; then
 
712
    # httpd had no output; echo a newline.
 
713
    echo ""
 
714
  elif [ -s "%s" ]; then
 
715
    # httpd would have printed an error terminated by a newline.
 
716
    kill -9 "`cat %s`"
 
717
  fi
 
718
fi
 
719
' >$STOPSCRIPT "$HTTPD_ROOT" "$START" "$HTTPD_PID" "$HTTPD_PID"
 
720
chmod +x $STOPSCRIPT
505
721
 
506
722
$START -t \
507
723
  || fail "Configuration file didn't pass the check, most likely modules couldn't be loaded"
531
747
  HTTP_FETCH_OUTPUT='-s -k -o'
532
748
fi
533
749
$HTTP_FETCH $HTTP_FETCH_OUTPUT "$HTTPD_CFG-copy" "$BASE_URL/cfg"
534
 
diff -q "$HTTPD_CFG" "$HTTPD_CFG-copy" > /dev/null \
 
750
diff "$HTTPD_CFG" "$HTTPD_CFG-copy" > /dev/null \
535
751
  || fail "HTTPD doesn't operate according to the generated configuration"
536
752
rm "$HTTPD_CFG-copy"
537
753
 
538
754
say "HTTPD is good"
539
755
 
540
756
if [ $# -eq 1 ] && [ "x$1" = 'x--no-tests' ]; then
541
 
  echo "http://localhost:$HTTPD_PORT"
542
 
  exit
543
 
fi
 
757
  echo "http://localhost:$HTTPD_PORT/svn-test-work/repositories"
 
758
  exit
 
759
fi
 
760
 
 
761
if [ $# -eq 1 ] && [ "x$1" = 'x--gdb' ]; then
 
762
  echo "http://localhost:$HTTPD_PORT/svn-test-work/repositories"
 
763
  $STOPSCRIPT && gdb -silent -ex r -args $START -X
 
764
  exit
 
765
fi
 
766
 
544
767
 
545
768
if type time > /dev/null; then
546
769
  TIME_CMD=time
548
771
  TIME_CMD=""
549
772
fi
550
773
 
 
774
MAKE=${MAKE:-make}
 
775
 
551
776
say "starting the tests..."
552
777
 
553
778
CLIENT_CMD="$ABS_BUILDDIR/subversion/svn/svn"
554
 
$LDD "$CLIENT_CMD" | grep -q 'not found' \
555
 
  && fail "Subversion client couldn't be fully linked at run-time"
556
779
 
557
780
if [ "$HTTP_LIBRARY" = "" ]; then
558
781
  say "Using default dav library"
559
 
  "$CLIENT_CMD" --version | egrep -q '^[*] ra_(neon|serf)' \
 
782
  "$CLIENT_CMD" --version | egrep '^[*] ra_(neon|serf)' >/dev/null \
560
783
    || fail "Subversion client couldn't find and/or load ra_dav library"
561
784
else
562
785
  say "Requesting dav library '$HTTP_LIBRARY'"
563
 
  "$CLIENT_CMD" --version | egrep -q "^[*] ra_$HTTP_LIBRARY" \
 
786
  "$CLIENT_CMD" --version | egrep "^[*] ra_$HTTP_LIBRARY" >/dev/null \
564
787
    || fail "Subversion client couldn't find and/or load ra_dav library '$HTTP_LIBRARY'"
565
788
fi
566
789
 
567
790
if [ $# = 0 ]; then
568
 
  $TIME_CMD make check "BASE_URL=$BASE_URL" $SSL_MAKE_VAR
 
791
  $TIME_CMD "$MAKE" check "BASE_URL=$BASE_URL" $SSL_MAKE_VAR
569
792
  r=$?
570
793
else
571
794
  (cd "$ABS_BUILDDIR/subversion/tests/cmdline/"