/
LibcxxAndAbiBuilder.py
147 lines (120 loc) · 5.58 KB
/
LibcxxAndAbiBuilder.py
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import buildbot.steps.shell
import buildbot.process.properties as properties
import zorg.buildbot.commands.LitTestCommand as lit_test_command
import zorg.buildbot.util.artifacts as artifacts
import zorg.buildbot.util.phasedbuilderutils as phased_builder_utils
from zorg.buildbot.commands.LitTestCommand import LitTestCommand
from zorg.buildbot.commands.CmakeCommand import CmakeCommand
from zorg.buildbot.process.factory import LLVMBuildFactory
from zorg.buildbot.builders import UnifiedTreeBuilder
reload(lit_test_command)
reload(artifacts)
reload(phased_builder_utils)
def getLibcxxAndAbiBuilder(f=None, env=None, additional_features=None,
cmake_extra_opts=None, lit_extra_opts=None,
lit_extra_args=None, check_libcxx_abilist=False,
check_libcxx_benchmarks=None,
depends_on_projects=None,
use_cache=None,
**kwargs):
if env is None:
env = {}
if additional_features is None:
additional_features = set()
if cmake_extra_opts is None:
cmake_extra_opts = {}
if lit_extra_opts is None:
lit_extra_opts = {}
if lit_extra_args is None:
lit_extra_args = []
if depends_on_projects is None:
depends_on_projects = ['libcxx','libcxxabi','libunwind']
src_root = 'llvm'
build_path = 'build'
if f is None:
f = UnifiedTreeBuilder.getLLVMBuildFactoryAndSourcecodeSteps(
depends_on_projects=depends_on_projects,
llvm_srcdir=src_root,
obj_dir=build_path,
**kwargs) # Pass through all the extra arguments.
rel_src_dir = LLVMBuildFactory.pathRelativeToBuild(f.llvm_srcdir, build_path)
# Specify the max number of threads using properties so LIT doesn't use
# all the threads on the system.
litTestArgs = '-vv --show-unsupported --show-xfail --threads=%(jobs)s'
if lit_extra_args:
litTestArgs += ' ' + ' '.join(lit_extra_args)
if additional_features:
litTestArgs += (' --param=additional_features=' +
','.join(additional_features))
for key in lit_extra_opts:
litTestArgs += (' --param=' + key + '=' + lit_extra_opts[key])
cmake_opts = [properties.WithProperties('-DLLVM_LIT_ARGS='+litTestArgs)]
for key in cmake_extra_opts:
cmake_opts.append('-D' + key + '=' + cmake_extra_opts[key])
if use_cache:
libcxx_cache_dir = '%s/../libcxx/cmake/caches' % rel_src_dir
cache = '%s/%s' % (libcxx_cache_dir, use_cache)
cmake_opts.append('-C' + cache)
# FIXME: The libc++ abilist's are generated in release mode with debug
# symbols Other configurations may contain additional non-inlined symbols.
if check_libcxx_abilist and not 'CMAKE_BUILD_TYPE' in cmake_extra_opts:
cmake_opts.append('-DCMAKE_BUILD_TYPE=RELWITHDEBINFO')
# Force libc++ to use the in-tree libc++abi unless otherwise specified.
if 'LIBCXX_CXX_ABI' not in cmake_extra_opts:
cmake_opts.append('-DLIBCXX_CXX_ABI=libcxxabi')
# Nuke/remake build directory and run CMake
f.addStep(buildbot.steps.shell.ShellCommand(
name='rm.builddir', command=['rm', '-rf', build_path],
workdir=".",
haltOnFailure=False))
if not f.is_legacy_mode:
CmakeCommand.applyRequiredOptions(cmake_opts, [
('-DLLVM_ENABLE_PROJECTS=', ";".join(f.depends_on_projects)),
])
f.addStep(buildbot.steps.shell.ShellCommand(
name='cmake', command=['cmake', rel_src_dir] + cmake_opts,
haltOnFailure=True, workdir=build_path, env=env))
# Build libcxxabi
jobs_flag = properties.WithProperties('-j%(jobs)s')
f.addStep(buildbot.steps.shell.ShellCommand(
name='build.libcxxabi', command=['make', jobs_flag, 'cxxabi'],
haltOnFailure=True, workdir=build_path))
# Build libcxx
f.addStep(buildbot.steps.shell.ShellCommand(
name='build.libcxx', command=['make', jobs_flag, 'cxx'],
haltOnFailure=True, workdir=build_path))
# Test libc++abi
f.addStep(LitTestCommand(
name = 'test.libcxxabi',
command = ['make', jobs_flag, 'check-cxxabi'],
description = ['testing', 'libcxxabi'],
descriptionDone = ['test', 'libcxxabi'],
workdir = build_path))
# Test libc++
f.addStep(LitTestCommand(
name = 'test.libcxx',
command = ['make', jobs_flag, 'check-cxx'],
description = ['testing', 'libcxx'],
descriptionDone = ['test', 'libcxx'],
workdir = build_path))
if check_libcxx_abilist:
f.addStep(buildbot.steps.shell.ShellCommand(
name = 'test.libcxx.abilist',
command = ['make', 'check-cxx-abilist'],
description = ['testing', 'libcxx', 'abi'],
descriptionDone = ['test', 'libcxx', 'abi'],
workdir = build_path))
if check_libcxx_benchmarks:
# Build the libc++ benchmarks
f.addStep(buildbot.steps.shell.ShellCommand(
name='build.libcxx.benchmarks',
command=['make', jobs_flag, 'cxx-benchmarks'],
haltOnFailure=True, workdir=build_path))
# Run the benchmarks
f.addStep(LitTestCommand(
name = 'test.libcxx.benchmarks',
command = ['make', jobs_flag, 'check-cxx-benchmarks'],
description = ['testing', 'libcxx', 'benchmarks'],
descriptionDone = ['test', 'libcxx', 'benchmarks'],
workdir = build_path))
return f