Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: infra/bots/common.py

Issue 1768273002: Swarming bots: add build products whitelist (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2016 Google Inc. 3 # Copyright 2016 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 8
9 import contextlib 9 import contextlib
10 import math 10 import math
(...skipping 13 matching lines...) Expand all
24 from flavor import ios_flavor 24 from flavor import ios_flavor
25 from flavor import valgrind_flavor 25 from flavor import valgrind_flavor
26 from flavor import xsan_flavor 26 from flavor import xsan_flavor
27 27
28 28
29 CONFIG_COVERAGE = 'Coverage' 29 CONFIG_COVERAGE = 'Coverage'
30 CONFIG_DEBUG = 'Debug' 30 CONFIG_DEBUG = 'Debug'
31 CONFIG_RELEASE = 'Release' 31 CONFIG_RELEASE = 'Release'
32 VALID_CONFIGS = (CONFIG_COVERAGE, CONFIG_DEBUG, CONFIG_RELEASE) 32 VALID_CONFIGS = (CONFIG_COVERAGE, CONFIG_DEBUG, CONFIG_RELEASE)
33 33
34 BUILD_PRODUCTS_WHITELIST = [
35 'dm', 'dm.exe',
36 'nanobench', 'nanobench.exe',
37 ]
38
34 GM_ACTUAL_FILENAME = 'actual-results.json' 39 GM_ACTUAL_FILENAME = 'actual-results.json'
35 GM_EXPECTATIONS_FILENAME = 'expected-results.json' 40 GM_EXPECTATIONS_FILENAME = 'expected-results.json'
36 GM_IGNORE_TESTS_FILENAME = 'ignored-tests.txt' 41 GM_IGNORE_TESTS_FILENAME = 'ignored-tests.txt'
37 42
38 GOLD_UNINTERESTING_HASHES_URL = 'https://gold.skia.org/_/hashes' 43 GOLD_UNINTERESTING_HASHES_URL = 'https://gold.skia.org/_/hashes'
39 44
40 GS_GM_BUCKET = 'chromium-skia-gm' 45 GS_GM_BUCKET = 'chromium-skia-gm'
41 GS_SUMMARIES_BUCKET = 'chromium-skia-gm-summaries' 46 GS_SUMMARIES_BUCKET = 'chromium-skia-gm-summaries'
42 47
43 GS_SUBDIR_TMPL_SK_IMAGE = 'skimage/v%s' 48 GS_SUBDIR_TMPL_SK_IMAGE = 'skimage/v%s'
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 """ 152 """
148 self.name = bot_name 153 self.name = bot_name
149 self.skia_dir = os.path.abspath(os.path.join( 154 self.skia_dir = os.path.abspath(os.path.join(
150 os.path.dirname(os.path.realpath(__file__)), 155 os.path.dirname(os.path.realpath(__file__)),
151 os.pardir, os.pardir)) 156 os.pardir, os.pardir))
152 self.swarm_out_dir = swarm_out_dir 157 self.swarm_out_dir = swarm_out_dir
153 os.chdir(self.skia_dir) 158 os.chdir(self.skia_dir)
154 self.build_dir = os.path.abspath(os.path.join(self.skia_dir, os.pardir)) 159 self.build_dir = os.path.abspath(os.path.join(self.skia_dir, os.pardir))
155 self.spec = self.get_bot_spec(bot_name) 160 self.spec = self.get_bot_spec(bot_name)
156 self.bot_cfg = self.spec['builder_cfg'] 161 self.bot_cfg = self.spec['builder_cfg']
157 if self.bot_cfg['role'] == 'Build': 162 self.out_dir = os.path.join(os.pardir, 'out')
158 self.out_dir = os.path.join(swarm_out_dir, 'out')
159 else:
160 self.out_dir = os.path.join(os.pardir, 'out')
161 self.configuration = self.spec['configuration'] 163 self.configuration = self.spec['configuration']
162 self.default_env = { 164 self.default_env = {
163 'SKIA_OUT': self.out_dir, 165 'SKIA_OUT': self.out_dir,
164 'BUILDTYPE': self.configuration, 166 'BUILDTYPE': self.configuration,
165 'PATH': os.environ['PATH'], 167 'PATH': os.environ['PATH'],
166 } 168 }
167 self.default_env.update(self.spec['env']) 169 self.default_env.update(self.spec['env'])
168 self.build_targets = [str(t) for t in self.spec['build_targets']] 170 self.build_targets = [str(t) for t in self.spec['build_targets']]
169 self.is_trybot = self.bot_cfg['is_trybot'] 171 self.is_trybot = self.bot_cfg['is_trybot']
170 self.upload_dm_results = self.spec['upload_dm_results'] 172 self.upload_dm_results = self.spec['upload_dm_results']
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 print '============' 237 print '============'
236 print 'CMD: %s' % cmd 238 print 'CMD: %s' % cmd
237 print 'CWD: %s' % cwd 239 print 'CWD: %s' % cwd
238 print 'ENV: %s' % _env 240 print 'ENV: %s' % _env
239 print '============' 241 print '============'
240 subprocess.check_call(cmd, env=_env, cwd=cwd) 242 subprocess.check_call(cmd, env=_env, cwd=cwd)
241 243
242 def compile_steps(self): 244 def compile_steps(self):
243 for t in self.build_targets: 245 for t in self.build_targets:
244 self.flavor.compile(t) 246 self.flavor.compile(t)
247 dst = os.path.join(self.swarm_out_dir, 'out', self.configuration)
248 os.makedirs(dst)
249 for f in BUILD_PRODUCTS_WHITELIST:
250 path = os.path.join(self.out_dir, self.configuration, f)
251 if os.path.exists(path):
252 print 'Copying build product %s' % path
253 shutil.copy(path, dst)
245 254
246 def _run_once(self, fn, *args, **kwargs): 255 def _run_once(self, fn, *args, **kwargs):
247 if not fn.__name__ in self._already_ran: 256 if not fn.__name__ in self._already_ran:
248 self._already_ran[fn.__name__] = True 257 self._already_ran[fn.__name__] = True
249 fn(*args, **kwargs) 258 fn(*args, **kwargs)
250 259
251 def install(self): 260 def install(self):
252 """Copy the required executables and files to the device.""" 261 """Copy the required executables and files to the device."""
253 self.device_dirs = self.flavor.get_device_dirs() 262 self.device_dirs = self.flavor.get_device_dirs()
254 263
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 self.flavor.run(abandonGpuContext, env=self.default_env) 456 self.flavor.run(abandonGpuContext, env=self.default_env)
448 457
449 # Copy results to host. 458 # Copy results to host.
450 if self.upload_perf_results: 459 if self.upload_perf_results:
451 if not os.path.exists(self.perf_data_dir): 460 if not os.path.exists(self.perf_data_dir):
452 os.makedirs(self.perf_data_dir) 461 os.makedirs(self.perf_data_dir)
453 self.flavor.copy_directory_contents_to_host( 462 self.flavor.copy_directory_contents_to_host(
454 self.device_dirs.perf_data_dir, self.perf_data_dir) 463 self.device_dirs.perf_data_dir, self.perf_data_dir)
455 464
456 self.flavor.cleanup_steps() 465 self.flavor.cleanup_steps()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698