-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
111 lines (104 loc) · 5.63 KB
/
Copy pathtest.py
File metadata and controls
111 lines (104 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import os
import re
import sys
from distutils.dir_util import mkpath
from configuration import *
def dotests():
def uses_boost(directory):
"""Returns `True` if there is a Boost folder inside the project
which is taken to indicating that the project requires the Boost
infrastructure to be set up."""
return os.path.exists(os.path.join(directory, 'Boost'))
def platform_boost(version):
return re.compile(r'[a-z]+').match(str(version))
def install_boost(directory, toolset, variant, version, patch, suffix):
"""
Installs the right version of Boost for the platform.
"""
if not uses_boost(directory) or not version: return
if not is_windows() and not platform_boost(version):
if not os.path.isdir('Boost/boost'):
os.mkdir('Boost/boost')
if not os.path.isdir('Boost/1_%s_%s%s' % (version, patch, suffix)):
worked('Boost/download', '1', version, patch, suffix)
worked('Boost/bootstrap', '1', version, patch, suffix)
path = '%s/Boost/1_%s_%s%s' % (directory, version, patch, suffix)
if not os.path.isdir(path):
print("Soft-linking to {}".format(path))
os.symlink('../../Boost/1_%s_%s%s' % (version, patch, suffix), path)
boost_folder = '%s/Boost/boost' % directory
if not os.path.isdir(boost_folder):
print("Soft-linking to {}".format(boost_folder))
os.symlink('../../Boost/boost', boost_folder)
if is_windows():
if not os.path.isdir('Boost/1_%s_%s' % (version, patch)):
execute('Boost\\build', version, patch)
def mode_boost(mode, boost):
if not len(mode.boost): return boost
inter = set(mode.boost).intersection(set(boost))
return [v for v in boost if v in inter]
built, success, failure = 0, [], []
for project, configuration in PROJECTS.items():
runtests = configuration.get('cmake', True)
directory = configuration.get('folder', project)
if runtests == False:
continue
elif runtests == True:
for toolset in TOOLSET.keys():
for mode_name, mode_opts in MODES[toolset].items():
for bmajor, bminor, bpatch in mode_boost(mode_opts, BOOST):
for variant in VARIANTS:
if platform_boost(bminor) and toolset != 'gcc':
break
install_boost(directory, toolset, variant,
bminor, bpatch, mode_opts.suffix)
if bmajor and bminor:
bver = "%d.%d.%d" % (bmajor, bminor, bpatch)
else:
bver = ''
failed = False
targets = [t for t in configuration.get('make', MAKE) if t not in SKIP_TARGETS]
tname = toolset + '-' + bver + '-' + variant
if mode_name: tname += '-' + mode_name
buildpath = '/'.join([directory, 'build.tmp', tname])
mkpath(buildpath)
cmd1 = [] + TOOLSET[toolset].get('env', []) # Python is idiotic
cmd1 += mode_opts.env
cmd1 += CMAKE
cmd1 += ['cmake', '../..', '-G', 'Ninja']
cmd1 += CMAKE_POST
cmd1 += TOOLSET[toolset].get('cmake', [])
cmd1 += mode_opts.cmake
conf = lambda n, v: cmd1 + ['-D' + n + '=' + v]
cmd1 = conf('CMAKE_BUILD_TYPE', variant.title())
if uses_boost(directory):
if bmajor or bminor or bpatch: cmd1 = conf('BOOST_SEARCH', 'NO')
if bmajor: cmd1 = conf('BOOST_VMAJOR', str(bmajor))
if bminor: cmd1 = conf('BOOST_VMINOR', str(bminor))
if bpatch: cmd1 = conf('BOOST_VPATCH', str(bpatch))
if mode_opts.suffix:
cmd1 = conf('BOOST_DIRECTORY_SUFFIX', mode_opts.suffix)
cmd1 = conf('CMAKE_INSTALL_PREFIX', '../../dist-test/' + tname)
worked(*['cd', buildpath, '&&'] + cmd1)
for target in targets:
built += 1
if not execute('cd', buildpath, '&&', 'ninja', target):
failure.append([project, (bmajor, bminor, bpatch), variant, [target], toolset, mode_name])
failed = True
break
if not failed:
success.append([project, (bmajor, bminor, bpatch), variant, targets, toolset, mode_name])
else:
assert execute('cd', project, '&&', runtests)
def status(k, l):
print('')
for project, boost, variant, targets, toolset, mode in l:
tmsg = ', '.join([t or "''" for t in targets])
print('{} {} Boost {} {} {} {} {}'.format(k, project, boost, toolset, variant, tmsg, mode))
status("Success", success)
status("Failure", failure)
print('\nTotal targets {} Successful configurations {}'.format(built, len(success)))
if len(failure):
print("At least one build failed")
sys.exit(2)
ACTIONS.append(dotests)