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

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

Issue 1813443003: Some fixes for Swarming bots (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Narrow down build products 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 | infra/bots/flavor/default_flavor.py » ('j') | 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 glob
10 import math 11 import math
11 import os 12 import os
12 import psutil 13 import psutil
13 import shutil 14 import shutil
14 import socket 15 import socket
15 import subprocess 16 import subprocess
16 import sys 17 import sys
17 import time 18 import time
18 import urllib2 19 import urllib2
19 20
20 from flavor import android_flavor 21 from flavor import android_flavor
21 from flavor import chromeos_flavor 22 from flavor import chromeos_flavor
22 from flavor import cmake_flavor 23 from flavor import cmake_flavor
23 from flavor import coverage_flavor 24 from flavor import coverage_flavor
24 from flavor import default_flavor 25 from flavor import default_flavor
25 from flavor import ios_flavor 26 from flavor import ios_flavor
26 from flavor import valgrind_flavor 27 from flavor import valgrind_flavor
27 from flavor import xsan_flavor 28 from flavor import xsan_flavor
28 29
29 30
30 CONFIG_COVERAGE = 'Coverage' 31 CONFIG_COVERAGE = 'Coverage'
31 CONFIG_DEBUG = 'Debug' 32 CONFIG_DEBUG = 'Debug'
32 CONFIG_RELEASE = 'Release' 33 CONFIG_RELEASE = 'Release'
33 VALID_CONFIGS = (CONFIG_COVERAGE, CONFIG_DEBUG, CONFIG_RELEASE) 34 VALID_CONFIGS = (CONFIG_COVERAGE, CONFIG_DEBUG, CONFIG_RELEASE)
34 35
35 BUILD_PRODUCTS_WHITELIST = [ 36 BUILD_PRODUCTS_WHITELIST = [
36 'dm', 'dm.exe', 37 'dm',
37 'nanobench', 'nanobench.exe', 38 'dm.exe',
39 'nanobench',
40 'nanobench.exe',
41 '*.so',
42 '*.dll',
38 ] 43 ]
39 44
40 GM_ACTUAL_FILENAME = 'actual-results.json' 45 GM_ACTUAL_FILENAME = 'actual-results.json'
41 GM_EXPECTATIONS_FILENAME = 'expected-results.json' 46 GM_EXPECTATIONS_FILENAME = 'expected-results.json'
42 GM_IGNORE_TESTS_FILENAME = 'ignored-tests.txt' 47 GM_IGNORE_TESTS_FILENAME = 'ignored-tests.txt'
43 48
44 GOLD_UNINTERESTING_HASHES_URL = 'https://gold.skia.org/_/hashes' 49 GOLD_UNINTERESTING_HASHES_URL = 'https://gold.skia.org/_/hashes'
45 50
46 GS_GM_BUCKET = 'chromium-skia-gm' 51 GS_GM_BUCKET = 'chromium-skia-gm'
47 GS_SUMMARIES_BUCKET = 'chromium-skia-gm-summaries' 52 GS_SUMMARIES_BUCKET = 'chromium-skia-gm-summaries'
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 print 'CWD: %s' % cwd 254 print 'CWD: %s' % cwd
250 print 'ENV: %s' % _env 255 print 'ENV: %s' % _env
251 print '============' 256 print '============'
252 subprocess.check_call(cmd, env=_env, cwd=cwd) 257 subprocess.check_call(cmd, env=_env, cwd=cwd)
253 258
254 def compile_steps(self): 259 def compile_steps(self):
255 for t in self.build_targets: 260 for t in self.build_targets:
256 self.flavor.compile(t) 261 self.flavor.compile(t)
257 dst = os.path.join(self.swarm_out_dir, 'out', self.configuration) 262 dst = os.path.join(self.swarm_out_dir, 'out', self.configuration)
258 os.makedirs(dst) 263 os.makedirs(dst)
259 for f in BUILD_PRODUCTS_WHITELIST: 264 for pattern in BUILD_PRODUCTS_WHITELIST:
260 path = os.path.join(self.out_dir, self.configuration, f) 265 path = os.path.join(self.out_dir, self.configuration, pattern)
261 if os.path.exists(path): 266 for f in glob.glob(path):
262 print 'Copying build product %s' % path 267 print 'Copying build product %s' % f
263 shutil.copy(path, dst) 268 shutil.copy(f, dst)
264 self.cleanup() 269 self.cleanup()
265 270
266 def _run_once(self, fn, *args, **kwargs): 271 def _run_once(self, fn, *args, **kwargs):
267 if not fn.__name__ in self._already_ran: 272 if not fn.__name__ in self._already_ran:
268 self._already_ran[fn.__name__] = True 273 self._already_ran[fn.__name__] = True
269 fn(*args, **kwargs) 274 fn(*args, **kwargs)
270 275
271 def install(self): 276 def install(self):
272 """Copy the required executables and files to the device.""" 277 """Copy the required executables and files to the device."""
273 self.device_dirs = self.flavor.get_device_dirs() 278 self.device_dirs = self.flavor.get_device_dirs()
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 def cleanup(self): 483 def cleanup(self):
479 if sys.platform == 'win32': 484 if sys.platform == 'win32':
480 # Kill mspdbsrv.exe, which tends to hang around after the build finishes. 485 # Kill mspdbsrv.exe, which tends to hang around after the build finishes.
481 for p in psutil.process_iter(): 486 for p in psutil.process_iter():
482 try: 487 try:
483 if p.name == 'mspdbsrv.exe': 488 if p.name == 'mspdbsrv.exe':
484 p.kill() 489 p.kill()
485 except psutil._error.AccessDenied: 490 except psutil._error.AccessDenied:
486 pass 491 pass
487 self.flavor.cleanup_steps() 492 self.flavor.cleanup_steps()
OLDNEW
« no previous file with comments | « no previous file | infra/bots/flavor/default_flavor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698