108
110
sys.path.insert(0, os.path.join('build', 'generator'))
109
111
sys.path.insert(1, 'build')
113
import gen_win_dependencies
112
115
version_header = os.path.join('subversion', 'include', 'svn_version.h')
113
116
cp = configparser.ConfigParser()
114
117
cp.read('gen-make.opts')
115
gen_obj = gen_win.GeneratorBase('build.conf', version_header,
117
all_tests = gen_obj.test_progs + gen_obj.bdb_test_progs \
118
+ gen_obj.scripts + gen_obj.bdb_scripts
119
client_tests = [x for x in all_tests if x.startswith(CMDLINE_TEST_SCRIPT_PATH)]
122
for section in gen_obj.sections.values():
123
if section.options.get("msvc-export"):
124
dll_basename = section.name + "-" + str(gen_obj.version) + ".dll"
125
svn_dlls.append(os.path.join("subversion", section.name, dll_basename))
118
gen_obj = gen_win_dependencies.GenDependenciesBase('build.conf', version_header,
127
120
opts, args = my_getopt(sys.argv[1:], 'hrdvqct:pu:f:',
128
121
['release', 'debug', 'verbose', 'quiet', 'cleanup',
129
122
'test=', 'url=', 'svnserve-args=', 'fs-type=', 'asp.net-hack',
130
123
'httpd-dir=', 'httpd-port=', 'httpd-daemon',
131
124
'httpd-server', 'http-short-circuit', 'httpd-no-log',
132
125
'disable-http-v2', 'disable-bulk-updates', 'help',
133
'fsfs-packing', 'fsfs-sharding=', 'javahl',
126
'fsfs-packing', 'fsfs-sharding=', 'javahl', 'swig=',
134
127
'list', 'enable-sasl', 'bin=', 'parallel',
135
128
'config-file=', 'server-minor-version=', 'log-level=',
136
129
'log-to-stdout', 'mode-filter=', 'milestone-filter=',
306
315
print("copy: %s" % src)
307
316
print(" to: %s" % tgt)
308
317
shutil.copy(src, tgt)
311
def copy_execs(baton, dirname, names):
314
if not name.endswith('.exe'):
316
src = os.path.join(dirname, name)
317
tgt = os.path.join(abs_builddir, dirname, name)
318
create_target_dir(dirname)
319
if copy_changed_file(src, tgt):
320
copied_execs.append(tgt)
320
copied_execs.append(tgt)
322
322
def locate_libs():
323
323
"Move DLLs to a known location and set env vars"
327
# look for APR 1.x dll's and use those if found
328
apr_test_path = os.path.join(gen_obj.apr_path, objdir, 'libapr-1.dll')
329
if os.path.exists(apr_test_path):
334
if cp.has_option('options', '--with-static-apr'):
335
dlls.append(os.path.join(gen_obj.apr_path, objdir,
336
'libapr%s.dll' % (suffix)))
337
dlls.append(os.path.join(gen_obj.apr_util_path, objdir,
338
'libaprutil%s.dll' % (suffix)))
340
if gen_obj.libintl_path is not None:
341
dlls.append(os.path.join(gen_obj.libintl_path, 'bin', 'intl3_svn.dll'))
343
if gen_obj.bdb_lib is not None:
344
partial_path = os.path.join(gen_obj.bdb_path, 'bin', gen_obj.bdb_lib)
345
if objdir == 'Debug':
346
dlls.append(partial_path + 'd.dll')
325
debug = (objdir == 'Debug')
327
for lib in gen_obj._libraries.values():
330
name, dir = lib.debug_dll_name, lib.debug_dll_dir
348
dlls.append(partial_path + '.dll')
350
if gen_obj.sasl_path is not None:
351
dlls.append(os.path.join(gen_obj.sasl_path, 'lib', 'libsasl.dll'))
354
copy_changed_file(dll, abs_objdir)
332
name, dir = lib.dll_name, lib.dll_dir
335
src = os.path.join(dir, name)
336
if os.path.exists(src):
337
copy_changed_file(src, to_dir=abs_builddir, cleanup=False)
339
for name in lib.extra_bin:
340
src = os.path.join(dir, name)
341
copy_changed_file(src, to_dir=abs_builddir)
356
344
# Copy the Subversion library DLLs
357
if not cp.has_option('options', '--disable-shared'):
358
for svn_dll in svn_dlls:
359
copy_changed_file(os.path.join(abs_objdir, svn_dll), abs_objdir)
345
for i in gen_obj.graph.get_all_sources(gen_base.DT_INSTALL):
346
if isinstance(i, gen_base.TargetLib) and i.msvc_export:
347
src = os.path.join(abs_objdir, i.filename)
348
if os.path.isfile(src):
349
copy_changed_file(src, to_dir=abs_builddir,
361
352
# Copy the Apache modules
362
353
if run_httpd and cp.has_option('options', '--with-httpd'):
652
645
' DontDoThatConfigFile ' + self._quote(self.dontdothat_file) + '\n' \
648
def _svn_authz_repo(self):
649
local_tmp = os.path.join(self.abs_builddir,
650
CMDLINE_TEST_SCRIPT_NATIVE_PATH,
651
'svn-test-work', 'local_tmp')
653
'<Location /authz-test-work/anon>' + '\n' \
655
' SVNParentPath ' + local_tmp + '\n' \
656
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
657
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
658
' SVNListParentPath On' + '\n' \
659
' <IfModule mod_authz_core.c>' + '\n' \
660
' Require all granted' + '\n' \
661
' </IfModule>' + '\n' \
662
' <IfModule !mod_authz_core.c>' + '\n' \
663
' Allow from all' + '\n' \
664
' </IfModule>' + '\n' \
665
' SVNPathAuthz ' + self.path_authz_option + '\n' \
666
'</Location>' + '\n' \
667
'<Location /authz-test-work/mixed>' + '\n' \
669
' SVNParentPath ' + local_tmp + '\n' \
670
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
671
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
672
' SVNListParentPath On' + '\n' \
673
' AuthType Basic' + '\n' \
674
' AuthName "Subversion Repository"' + '\n' \
675
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
676
' Require valid-user' + '\n' \
677
' Satisfy Any' + '\n' \
678
' SVNPathAuthz ' + self.path_authz_option + '\n' \
679
'</Location>' + '\n' \
680
'<Location /authz-test-work/mixed-noauthwhenanon>' + '\n' \
682
' SVNParentPath ' + local_tmp + '\n' \
683
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
684
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
685
' SVNListParentPath On' + '\n' \
686
' AuthType Basic' + '\n' \
687
' AuthName "Subversion Repository"' + '\n' \
688
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
689
' Require valid-user' + '\n' \
690
' AuthzSVNNoAuthWhenAnonymousAllowed On' + '\n' \
691
' SVNPathAuthz On' + '\n' \
692
'</Location>' + '\n' \
693
'<Location /authz-test-work/authn>' + '\n' \
695
' SVNParentPath ' + local_tmp + '\n' \
696
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
697
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
698
' SVNListParentPath On' + '\n' \
699
' AuthType Basic' + '\n' \
700
' AuthName "Subversion Repository"' + '\n' \
701
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
702
' Require valid-user' + '\n' \
703
' SVNPathAuthz ' + self.path_authz_option + '\n' \
704
'</Location>' + '\n' \
705
'<Location /authz-test-work/authn-anonoff>' + '\n' \
707
' SVNParentPath ' + local_tmp + '\n' \
708
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
709
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
710
' SVNListParentPath On' + '\n' \
711
' AuthType Basic' + '\n' \
712
' AuthName "Subversion Repository"' + '\n' \
713
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
714
' Require valid-user' + '\n' \
715
' AuthzSVNAnonymous Off' + '\n' \
716
' SVNPathAuthz On' + '\n' \
717
'</Location>' + '\n' \
718
'<Location /authz-test-work/authn-lcuser>' + '\n' \
720
' SVNParentPath ' + local_tmp + '\n' \
721
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
722
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
723
' SVNListParentPath On' + '\n' \
724
' AuthType Basic' + '\n' \
725
' AuthName "Subversion Repository"' + '\n' \
726
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
727
' Require valid-user' + '\n' \
728
' AuthzForceUsernameCase Lower' + '\n' \
729
' SVNPathAuthz ' + self.path_authz_option + '\n' \
730
'</Location>' + '\n' \
731
'<Location /authz-test-work/authn-lcuser>' + '\n' \
733
' SVNParentPath ' + local_tmp + '\n' \
734
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
735
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
736
' SVNListParentPath On' + '\n' \
737
' AuthType Basic' + '\n' \
738
' AuthName "Subversion Repository"' + '\n' \
739
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
740
' Require valid-user' + '\n' \
741
' AuthzForceUsernameCase Lower' + '\n' \
742
' SVNPathAuthz ' + self.path_authz_option + '\n' \
743
'</Location>' + '\n' \
744
'<Location /authz-test-work/authn-group>' + '\n' \
746
' SVNParentPath ' + local_tmp + '\n' \
747
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
748
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
749
' SVNListParentPath On' + '\n' \
750
' AuthType Basic' + '\n' \
751
' AuthName "Subversion Repository"' + '\n' \
752
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
753
' AuthGroupFile ' + self._quote(self.httpd_groups) + '\n' \
754
' Require group random' + '\n' \
755
' AuthzSVNAuthoritative Off' + '\n' \
756
' SVNPathAuthz On' + '\n' \
757
'</Location>' + '\n' \
758
'<IfModule mod_authz_core.c>' + '\n' \
759
'<Location /authz-test-work/sallrany>' + '\n' \
761
' SVNParentPath ' + local_tmp + '\n' \
762
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
763
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
764
' SVNListParentPath On' + '\n' \
765
' AuthType Basic' + '\n' \
766
' AuthName "Subversion Repository"' + '\n' \
767
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
768
' AuthzSendForbiddenOnFailure On' + '\n' \
769
' Satisfy All' + '\n' \
770
' <RequireAny>' + '\n' \
771
' Require valid-user' + '\n' \
772
' Require expr req(\'ALLOW\') == \'1\'' + '\n' \
773
' </RequireAny>' + '\n' \
774
' SVNPathAuthz ' + self.path_authz_option + '\n' \
775
'</Location>' + '\n' \
776
'<Location /authz-test-work/sallrall>'+ '\n' \
778
' SVNParentPath ' + local_tmp + '\n' \
779
' AuthzSVNAccessFile ' + self._quote(self.authz_file) + '\n' \
780
' SVNAdvertiseV2Protocol ' + self.httpv2_option + '\n' \
781
' SVNListParentPath On' + '\n' \
782
' AuthType Basic' + '\n' \
783
' AuthName "Subversion Repository"' + '\n' \
784
' AuthUserFile ' + self._quote(self.httpd_users) + '\n' \
785
' AuthzSendForbiddenOnFailure On' + '\n' \
786
' Satisfy All' + '\n' \
787
' <RequireAll>' + '\n' \
788
' Require valid-user' + '\n' \
789
' Require expr req(\'ALLOW\') == \'1\'' + '\n' \
790
'</RequireAll>' + '\n' \
791
' SVNPathAuthz ' + self.path_authz_option + '\n' \
792
'</Location>' + '\n' \
793
'</IfModule>' + '\n' \
657
797
self._start_service()
680
820
"Start HTTPD as daemon"
681
821
print('Starting httpd as daemon')
682
822
print(self.httpd_args)
686
args = ' '.join([self._quote(x) for x in self.httpd_args])
688
win32process.CreateProcess(self._quote(self.path), args,
690
win32con.CREATE_NEW_CONSOLE,
691
None, None, win32process.STARTUPINFO()))[0]
693
os.spawnv(os.P_NOWAIT, self.path, self.httpd_args)
823
self.proc = subprocess.Popen([self.path] + self.httpd_args[1:])
695
825
def _stop_daemon(self):
696
826
"Stop the HTTPD daemon"
697
if self.proc_handle is not None:
827
if self.proc is not None:
700
829
print('Stopping %s' % self.name)
701
win32process.TerminateProcess(self.proc_handle, 0)
831
if self.proc.returncode is None:
834
except AttributeError:
705
836
print('Httpd.stop_daemon not implemented')
707
838
# Move the binaries to the test directory
839
create_target_dir(abs_builddir)
710
old_cwd = os.getcwd()
714
for dirpath, dirs, files in os.walk('subversion'):
715
copy_execs(baton, dirpath, files)
716
for dirpath, dirs, files in os.walk('tools/server-side'):
717
copy_execs(baton, dirpath, files)
842
for i in gen_obj.graph.get_all_sources(gen_base.DT_INSTALL):
843
if isinstance(i, gen_base.TargetExe):
844
src = os.path.join(abs_objdir, i.filename)
846
if os.path.isfile(src):
847
dst = os.path.join(abs_builddir, i.filename)
848
create_target_dir(os.path.dirname(dst))
849
copy_changed_file(src, dst)
724
851
# Create the base directory for Python tests
725
852
create_target_dir(CMDLINE_TEST_SCRIPT_NATIVE_PATH)
807
939
os.chdir(old_cwd)
812
'-Dtest.rootdir=' + os.path.join(abs_builddir, 'javahl'),
813
'-Dtest.srcdir=' + os.path.join(abs_srcdir,
814
'subversion/bindings/javahl'),
816
'-Dtest.fstype=' + fs_type ,
819
'-Djava.library.path='
820
+ os.path.join(abs_objdir,
821
'subversion/bindings/javahl/native'),
823
os.path.join(abs_srcdir, 'subversion/bindings/javahl/classes') +';' +
828
print('Running org.apache.subversion tests:')
831
r = subprocess.call(args + tuple(['org.apache.subversion.javahl.RunTests']))
835
print('[Test runner reported failure]')
838
print('Running org.tigris.subversion tests:')
840
r = subprocess.call(args + tuple(['org.tigris.subversion.javahl.RunTests']))
844
print('[Test runner reported failure]')
945
for path in os.environ["PATH"].split(os.pathsep):
946
if os.path.isfile(os.path.join(path, 'java.exe')):
947
java_exe = os.path.join(path, 'java.exe')
950
if not java_exe and 'java_sdk' in gen_obj._libraries:
951
jdk = gen_obj._libraries['java_sdk']
953
if os.path.isfile(os.path.join(jdk.lib_dir, '../bin/java.exe')):
954
java_exe = os.path.join(jdk.lib_dir, '../bin/java.exe')
957
print('Java not found. Skipping Java tests')
959
args = (os.path.abspath(java_exe),)
960
if (objdir == 'Debug'):
961
args = args + ('-Xcheck:jni',)
964
'-Dtest.rootdir=' + os.path.join(abs_builddir, 'javahl'),
965
'-Dtest.srcdir=' + os.path.join(abs_srcdir,
966
'subversion/bindings/javahl'),
968
'-Dtest.fstype=' + fs_type ,
971
'-Djava.library.path='
972
+ os.path.join(abs_objdir,
973
'subversion/bindings/javahl/native'),
975
os.path.join(abs_srcdir, 'subversion/bindings/javahl/classes') +';' +
980
print('Running org.apache.subversion tests:')
983
r = subprocess.call(args + tuple(['org.apache.subversion.javahl.RunTests']))
987
print('[Test runner reported failure]')
990
print('Running org.tigris.subversion tests:')
992
r = subprocess.call(args + tuple(['org.tigris.subversion.javahl.RunTests']))
996
print('[Test runner reported failure]')
998
elif test_swig == 'perl':
1000
swig_dir = os.path.join(abs_builddir, 'swig')
1001
swig_pl_dir = os.path.join(swig_dir, 'p5lib')
1002
swig_pl_svn = os.path.join(swig_pl_dir, 'SVN')
1003
swig_pl_auto_svn = os.path.join(swig_pl_dir, 'auto', 'SVN')
1005
create_target_dir(swig_pl_svn)
1007
for i in gen_obj.graph.get_all_sources(gen_base.DT_INSTALL):
1008
if isinstance(i, gen_base.TargetSWIG) and i.lang == 'perl':
1009
mod_dir = os.path.join(swig_pl_auto_svn, '_' + i.name[5:].capitalize())
1010
create_target_dir(mod_dir)
1011
copy_changed_file(os.path.join(abs_objdir, i.filename), to_dir=mod_dir)
1013
elif isinstance(i, gen_base.TargetSWIGLib) and i.lang == 'perl':
1014
copy_changed_file(os.path.join(abs_objdir, i.filename),
1015
to_dir=abs_builddir)
1017
pm_src = os.path.join(abs_srcdir, 'subversion', 'bindings', 'swig', 'perl',
1022
for root, dirs, files in os.walk(pm_src):
1024
if name.endswith('.pm'):
1025
fn = os.path.join(root, name)
1026
copy_changed_file(fn, to_dir=swig_pl_svn)
1027
elif name.endswith('.t'):
1028
tests.append(os.path.relpath(os.path.join(root, name), pm_src))
1030
perl5lib = swig_pl_dir
1031
if 'PERL5LIB' in os.environ:
1032
perl5lib += os.pathsep + os.environ['PERL5LIB']
1034
perl_exe = 'perl.exe'
1036
print('-- Running Swig Perl tests --')
1038
old_cwd = os.getcwd()
1042
os.environ['PERL5LIB'] = perl5lib
1043
os.environ["SVN_DBG_NO_ABORT_ON_ERROR_LEAK"] = 'YES'
1045
r = subprocess.call([
1047
'-MExtUtils::Command::MM',
1048
'-e', 'test_harness()'
1054
print('[Test runner reported failure]')
1056
elif test_swig == 'python':
1058
swig_dir = os.path.join(abs_builddir, 'swig')
1059
swig_py_dir = os.path.join(swig_dir, 'pylib')
1060
swig_py_libsvn = os.path.join(swig_py_dir, 'libsvn')
1061
swig_py_svn = os.path.join(swig_py_dir, 'svn')
1063
create_target_dir(swig_py_libsvn)
1064
create_target_dir(swig_py_svn)
1066
for i in gen_obj.graph.get_all_sources(gen_base.DT_INSTALL):
1067
if (isinstance(i, gen_base.TargetSWIG)
1068
or isinstance(i, gen_base.TargetSWIGLib)) and i.lang == 'python':
1070
src = os.path.join(abs_objdir, i.filename)
1071
copy_changed_file(src, to_dir=swig_py_libsvn)
1073
py_src = os.path.join(abs_srcdir, 'subversion', 'bindings', 'swig', 'python')
1075
for py_file in os.listdir(py_src):
1076
if py_file.endswith('.py'):
1077
copy_changed_file(os.path.join(py_src, py_file),
1078
to_dir=swig_py_libsvn)
1080
py_src_svn = os.path.join(py_src, 'svn')
1081
for py_file in os.listdir(py_src_svn):
1082
if py_file.endswith('.py'):
1083
copy_changed_file(os.path.join(py_src_svn, py_file),
1086
print('-- Running Swig Python tests --')
1089
pythonpath = swig_py_dir
1090
if 'PYTHONPATH' in os.environ:
1091
pythonpath += os.pathsep + os.environ['PYTHONPATH']
1093
python_exe = 'python.exe'
1094
old_cwd = os.getcwd()
1096
os.environ['PYTHONPATH'] = pythonpath
1098
r = subprocess.call([
1100
os.path.join(py_src, 'tests', 'run_all.py')
1106
print('[Test runner reported failure]')
1109
elif test_swig == 'ruby':
1112
if 'ruby' not in gen_obj._libraries:
1113
print('Ruby not found. Skipping Ruby tests')
1115
ruby_lib = gen_obj._libraries['ruby']
1117
ruby_exe = 'ruby.exe'
1118
ruby_subdir = os.path.join('subversion', 'bindings', 'swig', 'ruby')
1120
'-I', os.path.join(abs_srcdir, ruby_subdir),
1121
os.path.join(abs_srcdir, ruby_subdir, 'test', 'run-test.rb'),
1125
print('-- Running Swig Ruby tests --')
1127
old_cwd = os.getcwd()
1129
os.chdir(ruby_subdir)
1131
os.environ["BUILD_TYPE"] = objdir
1132
os.environ["SVN_DBG_NO_ABORT_ON_ERROR_LEAK"] = 'YES'
1133
r = subprocess.call([ruby_exe] + ruby_args)
1140
print('[Test runner reported failure]')
847
1143
# Stop service daemon, if any