OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 Classes in this file define additional actions that need to be taken to run a | 6 Classes in this file define additional actions that need to be taken to run a |
7 test under some kind of runtime error detection tool. | 7 test under some kind of runtime error detection tool. |
8 | 8 |
9 The interface is intended to be used as follows. | 9 The interface is intended to be used as follows. |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 WRAPPER_NAME = '/system/bin/asanwrapper' | 97 WRAPPER_NAME = '/system/bin/asanwrapper' |
98 # Disable memcmp overlap check.There are blobs (gl drivers) | 98 # Disable memcmp overlap check.There are blobs (gl drivers) |
99 # on some android devices that use memcmp on overlapping regions, | 99 # on some android devices that use memcmp on overlapping regions, |
100 # nothing we can do about that. | 100 # nothing we can do about that. |
101 EXTRA_OPTIONS = 'strict_memcmp=0,use_sigaltstack=1' | 101 EXTRA_OPTIONS = 'strict_memcmp=0,use_sigaltstack=1' |
102 | 102 |
103 def __init__(self, device): | 103 def __init__(self, device): |
104 super(AddressSanitizerTool, self).__init__() | 104 super(AddressSanitizerTool, self).__init__() |
105 self._device = device | 105 self._device = device |
| 106 # Configure AndroidCommands to run utils (such as md5sum_bin) under ASan. |
| 107 # This is required because ASan is a compiler-based tool, and md5sum |
| 108 # includes instrumented code from base. |
| 109 device.old_interface.SetUtilWrapper(self.GetUtilWrapper()) |
106 | 110 |
107 @classmethod | 111 @classmethod |
108 def CopyFiles(cls, device): | 112 def CopyFiles(cls, device): |
109 """Copies ASan tools to the device.""" | 113 """Copies ASan tools to the device.""" |
110 libs = glob.glob(os.path.join(DIR_SOURCE_ROOT, | 114 libs = glob.glob(os.path.join(DIR_SOURCE_ROOT, |
111 'third_party/llvm-build/Release+Asserts/', | 115 'third_party/llvm-build/Release+Asserts/', |
112 'lib/clang/*/lib/linux/', | 116 'lib/clang/*/lib/linux/', |
113 'libclang_rt.asan-arm-android.so')) | 117 'libclang_rt.asan-arm-android.so')) |
114 assert len(libs) == 1 | 118 assert len(libs) == 1 |
115 subprocess.call( | 119 subprocess.call( |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 return | 295 return |
292 | 296 |
293 clazz = TOOL_REGISTRY.get(tool_name) | 297 clazz = TOOL_REGISTRY.get(tool_name) |
294 if clazz: | 298 if clazz: |
295 clazz.CopyFiles(device) | 299 clazz.CopyFiles(device) |
296 else: | 300 else: |
297 print 'Unknown tool %s, available tools: %s' % ( | 301 print 'Unknown tool %s, available tools: %s' % ( |
298 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) | 302 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) |
299 sys.exit(1) | 303 sys.exit(1) |
300 | 304 |
OLD | NEW |