| 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()) | |
| 110 | 106 |
| 111 @classmethod | 107 @classmethod |
| 112 def CopyFiles(cls, device): | 108 def CopyFiles(cls, device): |
| 113 """Copies ASan tools to the device.""" | 109 """Copies ASan tools to the device.""" |
| 114 libs = glob.glob(os.path.join(DIR_SOURCE_ROOT, | 110 libs = glob.glob(os.path.join(DIR_SOURCE_ROOT, |
| 115 'third_party/llvm-build/Release+Asserts/', | 111 'third_party/llvm-build/Release+Asserts/', |
| 116 'lib/clang/*/lib/linux/', | 112 'lib/clang/*/lib/linux/', |
| 117 'libclang_rt.asan-arm-android.so')) | 113 'libclang_rt.asan-arm-android.so')) |
| 118 assert len(libs) == 1 | 114 assert len(libs) == 1 |
| 119 subprocess.call( | 115 subprocess.call( |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 return | 291 return |
| 296 | 292 |
| 297 clazz = TOOL_REGISTRY.get(tool_name) | 293 clazz = TOOL_REGISTRY.get(tool_name) |
| 298 if clazz: | 294 if clazz: |
| 299 clazz.CopyFiles(device) | 295 clazz.CopyFiles(device) |
| 300 else: | 296 else: |
| 301 print 'Unknown tool %s, available tools: %s' % ( | 297 print 'Unknown tool %s, available tools: %s' % ( |
| 302 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) | 298 tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) |
| 303 sys.exit(1) | 299 sys.exit(1) |
| 304 | 300 |
| OLD | NEW |