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

Side by Side Diff: scripts/slave/recipe_modules/skia/xsan_flavor.py

Issue 1920283002: Modify Skia recipes to allow running XSAN on Swarming. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 """Utils for running under *SAN""" 6 """Utils for running under *SAN"""
7 7
8 8
9 import default_flavor 9 import default_flavor
10 10
11 11
12 class XSanFlavorUtils(default_flavor.DefaultFlavorUtils): 12 class XSanFlavorUtils(default_flavor.DefaultFlavorUtils):
13 def __init__(self, *args, **kwargs): 13 def __init__(self, *args, **kwargs):
14 super(XSanFlavorUtils, self).__init__(*args, **kwargs) 14 super(XSanFlavorUtils, self).__init__(*args, **kwargs)
15 key = self._skia_api.builder_cfg['extra_config']
16 # Remove "Swarming" from the beginning of extra_config.
17 if key.startswith("Swarming"):
18 key = key[len("Swarming"):]
15 self._sanitizer = { 19 self._sanitizer = {
16 # We'd love to just pass 'address,undefined' and get all the checks, but 20 # We'd love to just pass 'address,undefined' and get all the checks, but
17 # we're not anywhere close to being able to do that. Instead we start 21 # we're not anywhere close to being able to do that. Instead we start
18 # with a set of checks that we know pass or nearly pass. See here for 22 # with a set of checks that we know pass or nearly pass. See here for
19 # more information: 23 # more information:
20 # http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation 24 # http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
21 'ASAN': ('address,bool,function,integer-divide-by-zero,nonnull-attribute,' 25 'ASAN': ('address,bool,function,integer-divide-by-zero,nonnull-attribute,'
22 'null,object-size,return,returns-nonnull-attribute,shift,' 26 'null,object-size,return,returns-nonnull-attribute,shift,'
23 'signed-integer-overflow,unreachable,vla-bound,vptr'), 27 'signed-integer-overflow,unreachable,vla-bound,vptr'),
24 # MSAN and TSAN can't run together with ASAN, so they're their own bots. 28 # MSAN and TSAN can't run together with ASAN, so they're their own bots.
25 'MSAN': 'memory', 29 'MSAN': 'memory',
26 'TSAN': 'thread', 30 'TSAN': 'thread',
27 }[self._skia_api.builder_cfg['extra_config']] 31 }[key]
borenet 2016/05/04 11:15:55 I think I'd just do this: }[self._skia_api.builde
dogben 2016/05/04 13:48:02 I can do that if you think it's best, but I want t
dogben 2016/05/04 13:49:56 I'll change it to self._skia_api.builder_cfg['extr
borenet 2016/05/04 13:51:57 Oh, right. Replace SGTM, or you can leave it as-is
28 32
29 def compile(self, target): 33 def compile(self, target):
30 cmd = [self._skia_api.skia_dir.join('tools', 'xsan_build'), 34 cmd = [self._skia_api.skia_dir.join('tools', 'xsan_build'),
31 self._sanitizer, target] 35 self._sanitizer, target]
32 self._skia_api.run(self._skia_api.m.step, 'build %s' % target, cmd=cmd, 36 self._skia_api.run(self._skia_api.m.step, 'build %s' % target, cmd=cmd,
33 cwd=self._skia_api.skia_dir) 37 cwd=self._skia_api.skia_dir)
34 38
39 def copy_extra_build_products(self, swarming_out_dir):
40 # Include msan_out if MSAN.
41 if 'MSAN' in self._skia_api.builder_cfg['extra_config']:
42 msan_out = self._skia_api.m.path.join(
43 'third_party', 'externals', 'llvm', 'msan_out')
44 self._skia_api.m.file.copytree(
45 'copy msan_out',
46 self._skia_api.skia_dir.join(msan_out),
47 swarming_out_dir.join(msan_out),
48 symlinks=True)
49 # Include llvm_symbolizer from the Chromium DEPS so that suppressions work
50 # by symbol name.
51 # TODO(benjaminwagner): Figure out how to add this to Skia DEPS for
52 # target_os 'llvm'.
53 self._skia_api.m.file.copytree(
54 'copy llvm-build',
55 self._skia_api.checkout_root.join('src', 'third_party', 'llvm-build'),
56 swarming_out_dir.join('llvm-build'),
57 symlinks=True)
58
35 def step(self, name, cmd, env=None, **kwargs): 59 def step(self, name, cmd, env=None, **kwargs):
36 """Wrapper for the Step API; runs a step as appropriate for this flavor.""" 60 """Wrapper for the Step API; runs a step as appropriate for this flavor."""
37 skia_dir = self._skia_api.skia_dir 61 skia_dir = self._skia_api.skia_dir
38 lsan_suppressions = skia_dir.join('tools', 'lsan.supp') 62 lsan_suppressions = skia_dir.join('tools', 'lsan.supp')
39 tsan_suppressions = skia_dir.join('tools', 'tsan.supp') 63 tsan_suppressions = skia_dir.join('tools', 'tsan.supp')
40 ubsan_suppressions = skia_dir.join('tools', 'ubsan.supp') 64 ubsan_suppressions = skia_dir.join('tools', 'ubsan.supp')
41 env = dict(env or {}) 65 env = dict(env or {})
42 env['ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1' 66 env['ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1'
43 env['LSAN_OPTIONS'] = ('symbolize=1 print_suppressions=1 suppressions=%s' % 67 env['LSAN_OPTIONS'] = ('symbolize=1 print_suppressions=1 suppressions=%s' %
44 lsan_suppressions) 68 lsan_suppressions)
45 env['TSAN_OPTIONS'] = 'suppressions=%s' % tsan_suppressions 69 env['TSAN_OPTIONS'] = 'suppressions=%s' % tsan_suppressions
46 env['UBSAN_OPTIONS'] = 'suppressions=%s' % ubsan_suppressions 70 env['UBSAN_OPTIONS'] = 'suppressions=%s' % ubsan_suppressions
71 if self._skia_api.running_in_swarming:
72 self._skia_api.default_env['PATH'] = '%s:%s' % (
73 self._skia_api.default_env['PATH'],
74 self._skia_api.slave_dir.join('llvm-build', 'Release+Asserts', 'bin'))
47 75
48 path_to_app = self.out_dir.join(cmd[0]) 76 path_to_app = self.out_dir.join(cmd[0])
49 new_cmd = [path_to_app] 77 new_cmd = [path_to_app]
50 new_cmd.extend(cmd[1:]) 78 new_cmd.extend(cmd[1:])
51 return self._skia_api.run(self._skia_api.m.step, name, cmd=new_cmd, env=env, 79 return self._skia_api.run(self._skia_api.m.step, name, cmd=new_cmd, env=env,
52 **kwargs) 80 **kwargs)
53
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698