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 """Wrapper for running the test under heapchecker and analyzing the output.""" | 5 """Wrapper for running the test under heapchecker and analyzing the output.""" |
6 | 6 |
7 import datetime | 7 import datetime |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
11 | 11 |
12 import common | 12 import common |
13 import path_utils | 13 import path_utils |
14 import suppressions | 14 import suppressions |
15 | 15 |
16 | 16 |
17 class HeapcheckWrapper(object): | 17 class HeapcheckWrapper(object): |
18 TMP_FILE = 'heapcheck.log' | 18 TMP_FILE = 'heapcheck.log' |
19 SANITY_TEST_SUPPRESSION = "Heapcheck sanity test" | 19 SANITY_TEST_SUPPRESSION = "Heapcheck sanity test" |
20 LEAK_REPORT_RE = re.compile( | 20 LEAK_REPORT_RE = re.compile( |
21 'Leak of ([0-9]*) bytes in ([0-9]*) objects allocated from:') | 21 'Leak of ([0-9]*) bytes in ([0-9]*) objects allocated from:') |
22 STACK_LINE_RE = re.compile('\s*@\s*(?:0x)?[0-9a-fA-F]+\s*([^\n]*)') | 22 STACK_LINE_RE = re.compile('\s*@\s*(?:0x)?[0-9a-fA-F]+\s*([^\n]*)') |
23 BORING_CALLERS = common.BoringCallers(mangled=False, use_re_wildcards=True) | 23 BORING_CALLERS = common.BoringCallers(mangled=False, use_re_wildcards=True) |
24 | 24 |
25 def __init__(self, supp_files): | 25 def __init__(self, supp_files): |
26 self._mode = 'strict' | 26 self._mode = 'strict' |
27 self._timeout = 1200 | 27 self._timeout = 1800 |
28 self._nocleanup_on_exit = False | 28 self._nocleanup_on_exit = False |
29 self._suppressions = [] | 29 self._suppressions = [] |
30 for fname in supp_files: | 30 for fname in supp_files: |
31 self._suppressions.extend(suppressions.ReadSuppressionsFromFile(fname)) | 31 self._suppressions.extend(suppressions.ReadSuppressionsFromFile(fname)) |
32 if os.path.exists(self.TMP_FILE): | 32 if os.path.exists(self.TMP_FILE): |
33 os.remove(self.TMP_FILE) | 33 os.remove(self.TMP_FILE) |
34 | 34 |
35 def PutEnvAndLog(self, env_name, env_value): | 35 def PutEnvAndLog(self, env_name, env_value): |
36 """Sets the env var |env_name| to |env_value| and writes to logging.info. | 36 """Sets the env var |env_name| to |env_value| and writes to logging.info. |
37 """ | 37 """ |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 'http://dev.chromium.org/developers/how-tos/' | 229 'http://dev.chromium.org/developers/how-tos/' |
230 'using-the-heap-leak-checker') | 230 'using-the-heap-leak-checker') |
231 return retcode | 231 return retcode |
232 | 232 |
233 | 233 |
234 def RunTool(args, supp_files, module): | 234 def RunTool(args, supp_files, module): |
235 tool = HeapcheckWrapper(supp_files) | 235 tool = HeapcheckWrapper(supp_files) |
236 MODULES_TO_SANITY_CHECK = ["base"] | 236 MODULES_TO_SANITY_CHECK = ["base"] |
237 check_sanity = module in MODULES_TO_SANITY_CHECK | 237 check_sanity = module in MODULES_TO_SANITY_CHECK |
238 return tool.Main(args[1:], check_sanity) | 238 return tool.Main(args[1:], check_sanity) |
OLD | NEW |