blob: d88866304e597523efa8760c7b1b1e4bf4849718 [file] [log] [blame]
borenet1ed2ae42016-07-26 11:52:17 -07001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6# Recipe module for Skia Swarming compile.
7
8
9DEPS = [
borenet1436a092016-08-03 08:23:10 -070010 'core',
borenet1ed2ae42016-07-26 11:52:17 -070011 'recipe_engine/json',
12 'recipe_engine/path',
13 'recipe_engine/platform',
14 'recipe_engine/properties',
borenet1436a092016-08-03 08:23:10 -070015 'recipe_engine/python',
16 'flavor',
17 'run',
18 'vars',
borenet1ed2ae42016-07-26 11:52:17 -070019]
20
21
22TEST_BUILDERS = {
23 'client.skia.compile': {
24 'skiabot-linux-swarm-000': [
borenet1ed2ae42016-07-26 11:52:17 -070025 'Build-Mac-Clang-Arm7-Release-iOS',
Mike Klein6749af42016-11-07 15:38:48 -050026 'Build-Mac-Clang-arm64-Debug-GN_iOS',
mtklein82023d52016-08-29 13:14:55 -070027 'Build-Mac-Clang-mipsel-Debug-GN_Android',
borenet1ed2ae42016-07-26 11:52:17 -070028 'Build-Mac-Clang-x86_64-Debug-CommandBuffer',
mtkleinda8f6542016-08-31 12:35:21 -070029 'Build-Mac-Clang-x86_64-Release-GN',
mtklein82023d52016-08-29 13:14:55 -070030 'Build-Ubuntu-Clang-arm64-Release-GN_Android',
mtklein357f9d22016-09-13 13:50:09 -070031 'Build-Ubuntu-Clang-arm64-Release-GN_Android_Vulkan',
mtklein2b3c2a32016-09-08 08:39:34 -070032 'Build-Ubuntu-Clang-x86_64-Debug-ASAN',
borenet3f5a4752016-08-04 12:16:03 -070033 'Build-Ubuntu-Clang-x86_64-Debug-GN',
mtklein122fac32016-09-19 07:26:41 -070034 'Build-Ubuntu-Clang-arm64-Debug-GN_Android-Trybot',
35 'Build-Ubuntu-Clang-arm64-Debug-GN_Android_FrameworkDefs',
borenet151aee42016-07-27 14:05:54 -070036 'Build-Ubuntu-GCC-x86-Debug',
jcgregorioba595952016-07-28 09:38:59 -070037 'Build-Ubuntu-GCC-x86_64-Debug-GN',
mtklein82023d52016-08-29 13:14:55 -070038 'Build-Ubuntu-GCC-x86_64-Debug-MSAN',
borenete715d2d2016-09-15 09:08:48 -070039 'Build-Ubuntu-GCC-x86_64-Debug-NoGPU',
borenet2c3112d2016-08-05 06:30:10 -070040 'Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE',
41 'Build-Ubuntu-GCC-x86_64-Release-ANGLE',
borenet2c3112d2016-08-05 06:30:10 -070042 'Build-Ubuntu-GCC-x86_64-Release-Fast',
43 'Build-Ubuntu-GCC-x86_64-Release-Mesa',
borenet1ed2ae42016-07-26 11:52:17 -070044 'Build-Ubuntu-GCC-x86_64-Release-PDFium',
Eric Boren3dc73f32016-12-13 08:48:46 -050045 'Build-Ubuntu-GCC-x86_64-Release-PDFium_SkiaPaths',
borenet1ed2ae42016-07-26 11:52:17 -070046 'Build-Ubuntu-GCC-x86_64-Release-Valgrind',
Mike Klein86c2c0f2016-11-02 13:13:16 -040047 'Build-Win-Clang-arm64-Release-GN_Android',
borenet1ed2ae42016-07-26 11:52:17 -070048 'Build-Win-MSVC-x86-Debug',
Mike Klein97e4a862016-10-15 11:09:30 -040049 'Build-Win-MSVC-x86-Debug-ANGLE',
borenet2c3112d2016-08-05 06:30:10 -070050 'Build-Win-MSVC-x86-Debug-Exceptions',
51 'Build-Win-MSVC-x86-Release-GDI',
jcgregorioba595952016-07-28 09:38:59 -070052 'Build-Win-MSVC-x86-Release-GN',
borenet1ed2ae42016-07-26 11:52:17 -070053 'Build-Win-MSVC-x86_64-Release-Vulkan',
54 ],
55 },
56}
57
58
borenete2251ac2016-08-05 05:40:59 -070059def build_targets_from_builder_dict(builder_dict):
60 """Return a list of targets to build, depending on the builder type."""
61 if builder_dict.get('extra_config') == 'iOS':
62 return ['iOSShell']
mtklein3b10b372016-09-08 09:30:20 -070063 return ['most']
borenete2251ac2016-08-05 05:40:59 -070064
65
66def get_extra_env_vars(builder_dict):
67 env = {}
68 if builder_dict.get('compiler') == 'Clang':
69 env['CC'] = '/usr/bin/clang'
70 env['CXX'] = '/usr/bin/clang++'
71
72 # SKNX_NO_SIMD, SK_USE_DISCARDABLE_SCALEDIMAGECACHE, etc.
73 extra_config = builder_dict.get('extra_config', '')
74 if extra_config.startswith('SK') and extra_config.isupper():
borenet2c3112d2016-08-05 06:30:10 -070075 env['CPPFLAGS'] = '-D' + extra_config
borenete2251ac2016-08-05 05:40:59 -070076
77 return env
78
79
80def get_gyp_defines(builder_dict):
81 gyp_defs = {}
82
borenete2251ac2016-08-05 05:40:59 -070083 if (builder_dict.get('os') == 'iOS' or
84 builder_dict.get('extra_config') == 'iOS'):
Mike Kleinb9eb8872016-10-17 14:36:18 -040085 gyp_defs['skia_arch_type'] = 'arm'
borenete2251ac2016-08-05 05:40:59 -070086 gyp_defs['skia_clang_build'] = '1'
Mike Kleinb9eb8872016-10-17 14:36:18 -040087 gyp_defs['skia_os'] = 'ios'
88 gyp_defs['skia_warnings_as_errors'] = 1
borenete715d2d2016-09-15 09:08:48 -070089
borenete2251ac2016-08-05 05:40:59 -070090 return gyp_defs
91
92
borenet1ed2ae42016-07-26 11:52:17 -070093def RunSteps(api):
borenet1436a092016-08-03 08:23:10 -070094 api.core.setup()
95
borenete2251ac2016-08-05 05:40:59 -070096 env = get_extra_env_vars(api.vars.builder_cfg)
97 gyp_defs = get_gyp_defines(api.vars.builder_cfg)
98 gyp_defs_list = ['%s=%s' % (k, v) for k, v in gyp_defs.iteritems()]
99 gyp_defs_list.sort()
100 env['GYP_DEFINES'] = ' '.join(gyp_defs_list)
borenetd460a3c2016-08-05 05:18:05 -0700101
borenete2251ac2016-08-05 05:40:59 -0700102 build_targets = build_targets_from_builder_dict(api.vars.builder_cfg)
borenetd460a3c2016-08-05 05:18:05 -0700103
borenet1436a092016-08-03 08:23:10 -0700104 try:
borenetd460a3c2016-08-05 05:18:05 -0700105 for target in build_targets:
106 api.flavor.compile(target, env=env)
borenet1436a092016-08-03 08:23:10 -0700107 api.run.copy_build_products(
108 api.flavor.out_dir,
109 api.vars.swarming_out_dir.join(
110 'out', api.vars.configuration))
111 api.flavor.copy_extra_build_products(api.vars.swarming_out_dir)
112 finally:
113 if 'Win' in api.vars.builder_cfg.get('os', ''):
114 api.python.inline(
115 name='cleanup',
116 program='''import psutil
117for p in psutil.process_iter():
118 try:
119 if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'):
120 p.kill()
121 except psutil._error.AccessDenied:
122 pass
123''',
124 infra_step=True)
125
borenetbc20a702016-08-03 10:38:44 -0700126 api.flavor.cleanup_steps()
borenet1436a092016-08-03 08:23:10 -0700127 api.run.check_failure()
borenet1ed2ae42016-07-26 11:52:17 -0700128
129
130def GenTests(api):
131 for mastername, slaves in TEST_BUILDERS.iteritems():
132 for slavename, builders_by_slave in slaves.iteritems():
133 for builder in builders_by_slave:
134 test = (
135 api.test(builder) +
136 api.properties(buildername=builder,
137 mastername=mastername,
138 slavename=slavename,
139 buildnumber=5,
140 revision='abc123',
141 path_config='kitchen',
142 swarm_out_dir='[SWARM_OUT_DIR]') +
143 api.path.exists(
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500144 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
borenet1ed2ae42016-07-26 11:52:17 -0700145 )
146 )
147 if 'Win' in builder:
148 test += api.platform('win', 64)
149 elif 'Mac' in builder:
150 test += api.platform('mac', 64)
151 else:
152 test += api.platform('linux', 64)
borenet1ed2ae42016-07-26 11:52:17 -0700153 if 'Trybot' in builder:
154 test += api.properties(issue=500,
155 patchset=1,
156 rietveld='https://codereview.chromium.org')
157
158 yield test
159
160 mastername = 'client.skia.compile'
161 slavename = 'skiabot-win-compile-000'
Mike Klein97e4a862016-10-15 11:09:30 -0400162 buildername = 'Build-Win-MSVC-x86-Debug'
borenet1ed2ae42016-07-26 11:52:17 -0700163 yield (
164 api.test('big_issue_number') +
165 api.properties(buildername=buildername,
166 mastername=mastername,
167 slavename=slavename,
168 buildnumber=5,
169 revision='abc123',
170 path_config='kitchen',
171 swarm_out_dir='[SWARM_OUT_DIR]',
172 rietveld='https://codereview.chromium.org',
173 patchset=1,
174 issue=2147533002L) +
175 api.path.exists(
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500176 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
borenet1ed2ae42016-07-26 11:52:17 -0700177 ) +
178 api.platform('win', 64)
179 )
rmistry3f1c9c02016-08-24 05:07:06 -0700180
rmistry3f1c9c02016-08-24 05:07:06 -0700181 yield (
182 api.test('recipe_with_gerrit_patch') +
183 api.properties(
184 buildername=buildername + '-Trybot',
185 mastername=mastername,
186 slavename=slavename,
187 buildnumber=5,
188 path_config='kitchen',
189 swarm_out_dir='[SWARM_OUT_DIR]',
190 revision='abc123',
borenet96b38422016-10-27 06:35:51 -0700191 patch_storage='gerrit') +
192 api.properties.tryserver(
193 buildername=buildername + '-Trybot',
194 gerrit_project='skia',
195 gerrit_url='https://skia-review.googlesource.com/',
196 ) +
rmistry3f1c9c02016-08-24 05:07:06 -0700197 api.platform('win', 64)
198 )
borenet98b2e7a2016-10-13 06:23:45 -0700199
200 yield (
201 api.test('buildbotless_trybot_rietveld') +
202 api.properties(
203 repository='skia',
204 buildername=buildername,
205 mastername=mastername,
206 slavename=slavename,
207 buildnumber=5,
208 path_config='kitchen',
209 swarm_out_dir='[SWARM_OUT_DIR]',
210 revision='abc123',
211 nobuildbot='True',
212 issue=500,
213 patchset=1,
214 patch_storage='rietveld',
215 rietveld='https://codereview.chromium.org') +
216 api.platform('win', 64)
217 )
218
219 yield (
220 api.test('buildbotless_trybot_gerrit') +
221 api.properties(
222 repository='skia',
223 buildername=buildername,
224 mastername=mastername,
225 slavename=slavename,
226 buildnumber=5,
227 path_config='kitchen',
228 swarm_out_dir='[SWARM_OUT_DIR]',
229 revision='abc123',
230 nobuildbot='True',
borenet96b38422016-10-27 06:35:51 -0700231 patch_issue=500,
232 patch_set=1,
233 patch_storage='gerrit') +
234 api.properties.tryserver(
235 buildername=buildername,
236 gerrit_project='skia',
237 gerrit_url='https://skia-review.googlesource.com/',
238 ) +
borenet98b2e7a2016-10-13 06:23:45 -0700239 api.platform('win', 64)
240 )