24
24
For a list of options, run this script with the --help option.
27
# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.7.x/win-tests.py $
28
# $LastChangedRevision: 1145707 $
27
# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.8.x/win-tests.py $
28
# $LastChangedRevision: 1492044 $
30
30
import os, sys, subprocess
65
65
print(" -t, --test=TEST : Run the TEST test (all is default); use")
66
66
print(" TEST#n to run a particular test number,")
67
67
print(" multiples also accepted e.g. '2,4-7'")
68
print(" --log-level=LEVEL : Set log level to LEVEL (E.g. DEBUG)")
69
print(" --log-to-stdout : Write log results to stdout")
69
71
print(" --svnserve-args=list : comma-separated list of arguments for")
76
78
print(" will be used, if not specified")
77
79
print(" --httpd-daemon : Run Apache httpd as daemon")
78
80
print(" --httpd-service : Run Apache httpd as Windows service (default)")
79
print(" --http-library : dav library to use, neon (default) or serf")
81
print(" --httpd-no-log : Disable httpd logging")
80
82
print(" --http-short-circuit : Use SVNPathAuthz short_circuit on HTTP server")
81
83
print(" --disable-http-v2 : Do not advertise support for HTTPv2 on server")
82
84
print(" --disable-bulk-updates : Disable bulk updates on HTTP server")
85
print(" --ssl-cert : Path to SSL server certificate to trust.")
83
86
print(" --javahl : Run the javahl tests instead of the normal tests")
84
87
print(" --list : print test doc strings only")
85
88
print(" --milestone-filter=RE : RE is a regular expression pattern that (when")
93
96
print(" -p, --parallel : run multiple tests in parallel")
94
97
print(" --server-minor-version : the minor version of the server being")
96
print(" --config-file : Configuration file for tests")
97
print(" --fsfs-sharding : Specify shard size (for fsfs)")
98
print(" --fsfs-packing : Run 'svnadmin pack' automatically")
99
print(" --log-to-stdout : Write log results to stdout")
99
print(" --config-file : Configuration file for tests")
100
print(" --fsfs-sharding : Specify shard size (for fsfs)")
101
print(" --fsfs-packing : Run 'svnadmin pack' automatically")
126
128
['release', 'debug', 'verbose', 'quiet', 'cleanup',
127
129
'test=', 'url=', 'svnserve-args=', 'fs-type=', 'asp.net-hack',
128
130
'httpd-dir=', 'httpd-port=', 'httpd-daemon',
129
'httpd-server', 'http-library=', 'http-short-circuit',
131
'httpd-server', 'http-short-circuit', 'httpd-no-log',
130
132
'disable-http-v2', 'disable-bulk-updates', 'help',
131
133
'fsfs-packing', 'fsfs-sharding=', 'javahl',
132
134
'list', 'enable-sasl', 'bin=', 'parallel',
133
'config-file=', 'server-minor-version=',
134
'log-to-stdout', 'mode-filter=', 'milestone-filter='])
135
'config-file=', 'server-minor-version=', 'log-level=',
136
'log-to-stdout', 'mode-filter=', 'milestone-filter=',
135
138
if len(args) > 1:
136
139
print('Warning: non-option arguments after the first one will be ignored')
197
202
httpd_service = 0
198
203
elif opt == '--httpd-service':
199
204
httpd_service = 1
200
elif opt == '--http-library':
205
elif opt == '--httpd-no-log':
202
207
elif opt == '--http-short-circuit':
203
208
http_short_circuit = True
204
209
elif opt == '--disable-http-v2':
230
235
config_file = val
231
236
elif opt == '--log-to-stdout':
232
237
log_to_stdout = 1
238
elif opt == '--log-level':
240
elif opt == '--ssl-cert':
234
243
# Calculate the source and test directory names
235
244
abs_srcdir = os.path.abspath("")
302
311
def copy_execs(baton, dirname, names):
303
312
copied_execs = baton
304
313
for name in names:
305
ext = os.path.splitext(name)[1]
314
if not name.endswith('.exe'):
308
316
src = os.path.join(dirname, name)
309
317
tgt = os.path.join(abs_builddir, dirname, name)
356
364
'mod_dav_svn', 'mod_dav_svn.so')
357
365
mod_authz_svn_path = os.path.join(abs_objdir, 'subversion',
358
366
'mod_authz_svn', 'mod_authz_svn.so')
367
mod_dontdothat_path = os.path.join(abs_objdir, 'tools', 'server-side',
368
'mod_dontdothat', 'mod_dontdothat.so')
359
370
copy_changed_file(mod_dav_svn_path, abs_objdir)
360
371
copy_changed_file(mod_authz_svn_path, abs_objdir)
372
copy_changed_file(mod_dontdothat_path, abs_objdir)
362
374
os.environ['PATH'] = abs_objdir + os.pathsep + os.environ['PATH']
429
441
"Run httpd for DAV tests"
430
442
def __init__(self, abs_httpd_dir, abs_objdir, abs_builddir, httpd_port,
431
service, httpv2, short_circuit, bulk_updates):
443
service, no_log, httpv2, short_circuit, bulk_updates):
432
444
self.name = 'apache.exe'
433
445
self.httpd_port = httpd_port
434
446
self.httpd_dir = abs_httpd_dir
463
475
self.authz_file = os.path.join(abs_builddir,
464
476
CMDLINE_TEST_SCRIPT_NATIVE_PATH,
465
477
'svn-test-work', 'authz')
478
self.dontdothat_file = os.path.join(abs_builddir,
479
CMDLINE_TEST_SCRIPT_NATIVE_PATH,
480
'svn-test-work', 'dontdothat')
466
481
self.httpd_config = os.path.join(self.root, 'httpd.conf')
467
482
self.httpd_users = os.path.join(self.root, 'users')
468
483
self.httpd_mime_types = os.path.join(self.root, 'mime.types')
481
496
self._create_users_file()
482
497
self._create_mime_types_file()
498
self._create_dontdothat_file()
484
500
# Determine version.
485
501
if os.path.exists(os.path.join(self.httpd_dir,
505
521
fp.write('ServerName localhost\n')
506
522
fp.write('PidFile pid\n')
507
523
fp.write('ErrorLog log\n')
508
fp.write('LogFormat "%h %l %u %t \\"%r\\" %>s %b" common\n')
509
fp.write('Customlog log common\n')
510
fp.write('LogLevel Debug\n')
511
524
fp.write('Listen ' + str(self.httpd_port) + '\n')
527
fp.write('LogFormat "%h %l %u %t \\"%r\\" %>s %b" common\n')
528
fp.write('Customlog log common\n')
529
fp.write('LogLevel Debug\n')
531
fp.write('LogLevel Crit\n')
513
533
# Write LoadModule for minimal system module
514
534
fp.write(self._sys_module('dav_module', 'mod_dav.so'))
515
535
if self.httpd_ver >= 2.3:
530
550
fp.write(self._svn_module('dav_svn_module', 'mod_dav_svn.so'))
531
551
fp.write(self._svn_module('authz_svn_module', 'mod_authz_svn.so'))
553
# And for mod_dontdothat
554
fp.write(self._svn_module('dontdothat_module', 'mod_dontdothat.so'))
556
# Don't handle .htaccess, symlinks, etc.
557
fp.write('<Directory />\n')
558
fp.write('AllowOverride None\n')
559
fp.write('Options None\n')
560
fp.write('</Directory>\n\n')
533
562
# Define two locations for repositories
534
563
fp.write(self._svn_repo('repositories'))
535
564
fp.write(self._svn_repo('local_tmp'))
558
587
def _create_users_file(self):
559
588
"Create users file"
560
589
htpasswd = os.path.join(self.httpd_dir, 'bin', 'htpasswd.exe')
561
os.spawnv(os.P_WAIT, htpasswd, ['htpasswd.exe', '-mbc', self.httpd_users,
590
# Create the cheapest to compare password form for our testsuite
591
os.spawnv(os.P_WAIT, htpasswd, ['htpasswd.exe', '-bcp', self.httpd_users,
562
592
'jrandom', 'rayjandom'])
563
os.spawnv(os.P_WAIT, htpasswd, ['htpasswd.exe', '-mb', self.httpd_users,
593
os.spawnv(os.P_WAIT, htpasswd, ['htpasswd.exe', '-bp', self.httpd_users,
564
594
'jconstant', 'rayjandom'])
566
596
def _create_mime_types_file(self):
568
598
fp = open(self.httpd_mime_types, 'w')
601
def _create_dontdothat_file(self):
602
"Create empty mime.types file"
603
# If the tests have not previously been run or were cleaned
604
# up, then 'svn-test-work' does not exist yet.
605
parent_dir = os.path.dirname(self.dontdothat_file)
606
if not os.path.exists(parent_dir):
607
os.makedirs(parent_dir)
609
fp = open(self.dontdothat_file, 'w')
610
fp.write('[recursive-actions]\n')
611
fp.write('/ = deny\n')
571
614
def _sys_module(self, name, path):
572
615
full_path = os.path.join(self.httpd_dir, 'modules', path)
573
616
return 'LoadModule ' + name + " " + self._quote(full_path) + '\n'
581
624
CMDLINE_TEST_SCRIPT_NATIVE_PATH,
582
625
'svn-test-work', name)
583
626
location = '/svn-test-work/' + name
627
ddt_location = '/ddt-test-work/' + name
585
629
'<Location ' + location + '>\n' \
593
637
' AuthName "Subversion Repository"\n' \
594
638
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
595
639
' Require valid-user\n' \
641
'<Location ' + ddt_location + '>\n' \
643
' SVNParentPath ' + self._quote(path) + '\n' \
644
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
645
' SVNPathAuthz ' + self.path_authz_option + '\n' \
646
' SVNAllowBulkUpdates ' + self.bulkupdates_option + '\n' \
647
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
648
' AuthType Basic\n' \
649
' AuthName "Subversion Repository"\n' \
650
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
651
' Require valid-user\n' \
652
' DontDoThatConfigFile ' + self._quote(self.dontdothat_file) + '\n' \
655
712
os.chdir(abs_objdir)
656
713
baton = copied_execs
657
714
for dirpath, dirs, files in os.walk('subversion'):
658
copy_execs(baton, dirpath, dirs + files)
659
for dirpath, dirs, files in os.walk('tools/client-side/svnmucc'):
660
copy_execs(baton, dirpath, dirs + files)
715
copy_execs(baton, dirpath, files)
716
for dirpath, dirs, files in os.walk('tools/server-side'):
717
copy_execs(baton, dirpath, files)
662
719
os.chdir(old_cwd)
682
739
daemon = Httpd(abs_httpd_dir, abs_objdir, abs_builddir, httpd_port,
683
httpd_service, advertise_httpv2, http_short_circuit,
740
httpd_service, httpd_no_log,
741
advertise_httpv2, http_short_circuit,
684
742
http_bulk_updates)
686
744
# Start service daemon, if any
731
789
th = run_tests.TestHarness(abs_srcdir, abs_builddir,
734
base_url, fs_type, http_library,
792
base_url, fs_type, 'serf',
735
793
server_minor_version, not quiet,
736
794
cleanup, enable_sasl, parallel, config_file,
737
795
fsfs_sharding, fsfs_packing,
738
796
list_tests, svn_bin, mode_filter,
798
set_log_level=log_level, ssl_cert=ssl_cert)
740
799
old_cwd = os.getcwd()
742
801
os.chdir(abs_builddir)