OLD | NEW |
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, m): | 13 def __init__(self, m): |
14 super(XSanFlavorUtils, self).__init__(m) | 14 super(XSanFlavorUtils, self).__init__(m) |
15 self._sanitizer = { | 15 self._sanitizer = { |
16 # We'd love to just pass 'address,undefined' and get all the checks, but | 16 # 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 | 17 # 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 | 18 # with a set of checks that we know pass or nearly pass. See here for |
19 # more information: | 19 # more information: |
20 # http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation | 20 # http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation |
21 'ASAN': ('address,bool,function,integer-divide-by-zero,nonnull-attribute,' | 21 'ASAN': ('address,bool,function,integer-divide-by-zero,nonnull-attribute,' |
22 'null,object-size,return,returns-nonnull-attribute,shift,' | 22 'null,object-size,return,returns-nonnull-attribute,shift,' |
23 'signed-integer-overflow,unreachable,vla-bound,vptr'), | 23 'signed-integer-overflow,unreachable,vla-bound,vptr'), |
24 # MSAN and TSAN can't run together with ASAN, so they're their own bots. | 24 # MSAN and TSAN can't run together with ASAN, so they're their own bots. |
25 'MSAN': 'memory', | 25 'MSAN': 'memory', |
26 'TSAN': 'thread', | 26 'TSAN': 'thread', |
27 }[self.m.vars.builder_cfg['extra_config'].replace('Swarming', '')] | 27 }[self.m.vars.builder_cfg['extra_config'].replace('Swarming', '')] |
28 | 28 |
29 def compile(self, target): | 29 def compile(self, target, **kwargs): |
30 cmd = [self.m.vars.skia_dir.join('tools', 'xsan_build'), | 30 cmd = [self.m.vars.skia_dir.join('tools', 'xsan_build'), |
31 self._sanitizer, target] | 31 self._sanitizer, target] |
32 self.m.run(self.m.step, 'build %s' % target, cmd=cmd, | 32 self.m.run(self.m.step, 'build %s' % target, cmd=cmd, |
33 cwd=self.m.vars.skia_dir) | 33 cwd=self.m.vars.skia_dir, **kwargs) |
34 | 34 |
35 def copy_extra_build_products(self, swarming_out_dir): | 35 def copy_extra_build_products(self, swarming_out_dir): |
36 # Include msan_out if MSAN. | 36 # Include msan_out if MSAN. |
37 if 'MSAN' in self.m.vars.builder_cfg['extra_config']: | 37 if 'MSAN' in self.m.vars.builder_cfg['extra_config']: |
38 msan_out = self.m.path.join( | 38 msan_out = self.m.path.join( |
39 'third_party', 'externals', 'llvm', 'msan_out') | 39 'third_party', 'externals', 'llvm', 'msan_out') |
40 self.m.file.copytree( | 40 self.m.file.copytree( |
41 'copy msan_out', | 41 'copy msan_out', |
42 self.m.vars.skia_dir.join(msan_out), | 42 self.m.vars.skia_dir.join(msan_out), |
43 swarming_out_dir.join(msan_out), | 43 swarming_out_dir.join(msan_out), |
(...skipping 22 matching lines...) Expand all Loading... |
66 env['UBSAN_OPTIONS'] = 'suppressions=%s' % ubsan_suppressions | 66 env['UBSAN_OPTIONS'] = 'suppressions=%s' % ubsan_suppressions |
67 self.m.vars.default_env['PATH'] = '%%(PATH)s:%s' % ( | 67 self.m.vars.default_env['PATH'] = '%%(PATH)s:%s' % ( |
68 self.m.vars.slave_dir.join('llvm-build', 'Release+Asserts', 'bin')) | 68 self.m.vars.slave_dir.join('llvm-build', 'Release+Asserts', 'bin')) |
69 env['LD_LIBRARY_PATH'] = self.m.vars.slave_dir.join( | 69 env['LD_LIBRARY_PATH'] = self.m.vars.slave_dir.join( |
70 'third_party', 'externals', 'llvm', 'msan_out', 'lib') | 70 'third_party', 'externals', 'llvm', 'msan_out', 'lib') |
71 | 71 |
72 path_to_app = self.out_dir.join(cmd[0]) | 72 path_to_app = self.out_dir.join(cmd[0]) |
73 new_cmd = [path_to_app] | 73 new_cmd = [path_to_app] |
74 new_cmd.extend(cmd[1:]) | 74 new_cmd.extend(cmd[1:]) |
75 return self.m.run(self.m.step, name, cmd=new_cmd, env=env, **kwargs) | 75 return self.m.run(self.m.step, name, cmd=new_cmd, env=env, **kwargs) |
OLD | NEW |