| 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 """Runs an exe through Valgrind and puts the intermediate files in a | 5 """Runs an exe through Valgrind and puts the intermediate files in a |
| 6 directory. | 6 directory. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import datetime | 9 import datetime |
| 10 import glob | 10 import glob |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 else: | 1158 else: |
| 1159 logging.info("No reports, skipping RaceVerifier second pass") | 1159 logging.info("No reports, skipping RaceVerifier second pass") |
| 1160 logging.info("Please see " + self.MORE_INFO_URL + " for more information " + | 1160 logging.info("Please see " + self.MORE_INFO_URL + " for more information " + |
| 1161 "on RaceVerifier") | 1161 "on RaceVerifier") |
| 1162 return ret | 1162 return ret |
| 1163 | 1163 |
| 1164 def Run(self, args, module, min_runtime_in_seconds=0): | 1164 def Run(self, args, module, min_runtime_in_seconds=0): |
| 1165 return self.Main(args, False, min_runtime_in_seconds) | 1165 return self.Main(args, False, min_runtime_in_seconds) |
| 1166 | 1166 |
| 1167 | 1167 |
| 1168 class EmbeddedTool(BaseTool): | |
| 1169 """Abstract class for tools embedded directly into the test binary. | |
| 1170 """ | |
| 1171 # TODO(glider): need to override Execute() and support process chaining here. | |
| 1172 | |
| 1173 def ToolCommand(self): | |
| 1174 # In the simplest case just the args of the script. | |
| 1175 return self._args | |
| 1176 | |
| 1177 | |
| 1178 class Asan(EmbeddedTool): | |
| 1179 """AddressSanitizer, a memory error detector. | |
| 1180 | |
| 1181 More information at | |
| 1182 http://dev.chromium.org/developers/testing/addresssanitizer | |
| 1183 """ | |
| 1184 def __init__(self): | |
| 1185 super(Asan, self).__init__() | |
| 1186 self._timeout = 1200 | |
| 1187 if common.IsMac(): | |
| 1188 self._env["DYLD_NO_PIE"] = "1" | |
| 1189 | |
| 1190 | |
| 1191 def ToolName(self): | |
| 1192 return "asan" | |
| 1193 | |
| 1194 def ToolCommand(self): | |
| 1195 # TODO(glider): use pipes instead of the ugly wrapper here once they | |
| 1196 # are supported. | |
| 1197 procs = [os.path.join(self._source_dir, "tools", "valgrind", | |
| 1198 "asan", "asan_wrapper.sh")] | |
| 1199 procs.extend(self._args) | |
| 1200 return procs | |
| 1201 | |
| 1202 def Analyze(sels, unused_check_sanity): | |
| 1203 return 0 | |
| 1204 | |
| 1205 | |
| 1206 class ToolFactory: | 1168 class ToolFactory: |
| 1207 def Create(self, tool_name): | 1169 def Create(self, tool_name): |
| 1208 if tool_name == "memcheck": | 1170 if tool_name == "memcheck": |
| 1209 return Memcheck() | 1171 return Memcheck() |
| 1210 if tool_name == "tsan": | 1172 if tool_name == "tsan": |
| 1211 if common.IsWindows(): | 1173 if common.IsWindows(): |
| 1212 return ThreadSanitizerWindows() | 1174 return ThreadSanitizerWindows() |
| 1213 else: | 1175 else: |
| 1214 return ThreadSanitizerPosix() | 1176 return ThreadSanitizerPosix() |
| 1215 if tool_name == "drmemory" or tool_name == "drmemory_light": | 1177 if tool_name == "drmemory" or tool_name == "drmemory_light": |
| 1216 # TODO(timurrrr): remove support for "drmemory" when buildbots are | 1178 # TODO(timurrrr): remove support for "drmemory" when buildbots are |
| 1217 # switched to drmemory_light OR make drmemory==drmemory_full the default | 1179 # switched to drmemory_light OR make drmemory==drmemory_full the default |
| 1218 # mode when the tool is mature enough. | 1180 # mode when the tool is mature enough. |
| 1219 return DrMemory(False, False) | 1181 return DrMemory(False, False) |
| 1220 if tool_name == "drmemory_full": | 1182 if tool_name == "drmemory_full": |
| 1221 return DrMemory(True, False) | 1183 return DrMemory(True, False) |
| 1222 if tool_name == "drmemory_pattern": | 1184 if tool_name == "drmemory_pattern": |
| 1223 return DrMemory(False, True) | 1185 return DrMemory(False, True) |
| 1224 if tool_name == "tsan_rv": | 1186 if tool_name == "tsan_rv": |
| 1225 return RaceVerifier() | 1187 return RaceVerifier() |
| 1226 if tool_name == "asan": | |
| 1227 return Asan() | |
| 1228 try: | 1188 try: |
| 1229 platform_name = common.PlatformNames()[0] | 1189 platform_name = common.PlatformNames()[0] |
| 1230 except common.NotImplementedError: | 1190 except common.NotImplementedError: |
| 1231 platform_name = sys.platform + "(Unknown)" | 1191 platform_name = sys.platform + "(Unknown)" |
| 1232 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 1192 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
| 1233 platform_name) | 1193 platform_name) |
| 1234 | 1194 |
| 1235 def CreateTool(tool): | 1195 def CreateTool(tool): |
| 1236 return ToolFactory().Create(tool) | 1196 return ToolFactory().Create(tool) |
| OLD | NEW |