OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # suppressions.py | 6 # suppressions.py |
7 | 7 |
8 """Post-process Valgrind suppression matcher. | 8 """Post-process Valgrind suppression matcher. |
9 | 9 |
10 Suppressions are defined as follows: | 10 Suppressions are defined as follows: |
(...skipping 11 matching lines...) Expand all Loading... | |
22 } | 22 } |
23 | 23 |
24 If ran from the command line, suppressions.py does a self-test | 24 If ran from the command line, suppressions.py does a self-test |
25 of the Suppression class. | 25 of the Suppression class. |
26 """ | 26 """ |
27 | 27 |
28 import os | 28 import os |
29 import re | 29 import re |
30 import sys | 30 import sys |
31 | 31 |
32 import path_utils | |
Timur Iskhodzhanov
2012/12/03 11:14:13
Traceback (most recent call last):
File "../depo
| |
33 | |
34 | |
32 ELLIPSIS = '...' | 35 ELLIPSIS = '...' |
33 | 36 |
34 | 37 |
38 def GetSuppressions(): | |
39 suppressions_root = path_utils.ScriptDir() | |
40 JOIN = os.path.join | |
41 | |
42 result = {} | |
43 | |
44 supp_filename = JOIN(suppressions_root, "memcheck", "suppressions.txt") | |
45 vg_common = ReadSuppressionsFromFile(supp_filename) | |
46 supp_filename = JOIN(suppressions_root, "tsan", "suppressions.txt") | |
47 tsan_common = ReadSuppressionsFromFile(supp_filename) | |
48 result['common_suppressions'] = vg_common + tsan_common | |
49 | |
50 supp_filename = JOIN(suppressions_root, "memcheck", "suppressions_mac.txt") | |
51 vg_mac = ReadSuppressionsFromFile(supp_filename) | |
52 supp_filename = JOIN(suppressions_root, "tsan", "suppressions_mac.txt") | |
53 tsan_mac = ReadSuppressionsFromFile(supp_filename) | |
54 result['mac_suppressions'] = vg_mac + tsan_mac | |
55 | |
56 supp_filename = JOIN(suppressions_root, "tsan", "suppressions_win32.txt") | |
57 tsan_win = ReadSuppressionsFromFile(supp_filename) | |
58 result['win_suppressions'] = tsan_win | |
59 | |
60 supp_filename = JOIN(suppressions_root, "..", "heapcheck", "suppressions.txt") | |
61 result['heapcheck_suppressions'] = ReadSuppressionsFromFile(supp_filename) | |
62 | |
63 supp_filename = JOIN(suppressions_root, "drmemory", "suppressions.txt") | |
64 result['drmem_suppressions'] = ReadSuppressionsFromFile(supp_filename) | |
65 supp_filename = JOIN(suppressions_root, "drmemory", "suppressions_full.txt") | |
66 result['drmem_full_suppressions'] = ReadSuppressionsFromFile(supp_filename) | |
67 | |
68 return result | |
69 | |
70 | |
35 def GlobToRegex(glob_pattern, ignore_case=False): | 71 def GlobToRegex(glob_pattern, ignore_case=False): |
36 """Translate glob wildcards (*?) into regex syntax. Escape the rest.""" | 72 """Translate glob wildcards (*?) into regex syntax. Escape the rest.""" |
37 regex = '' | 73 regex = '' |
38 for char in glob_pattern: | 74 for char in glob_pattern: |
39 if char == '*': | 75 if char == '*': |
40 regex += '.*' | 76 regex += '.*' |
41 elif char == '?': | 77 elif char == '?': |
42 regex += '.' | 78 regex += '.' |
43 elif ignore_case and char.isalpha(): | 79 elif ignore_case and char.isalpha(): |
44 regex += '[%s%s]' % (char.lower(), char.upper()) | 80 regex += '[%s%s]' % (char.lower(), char.upper()) |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 "instruction=test 0x08(%eax) $0x01\n" | 997 "instruction=test 0x08(%eax) $0x01\n" |
962 "ntdll.dll!*\n" | 998 "ntdll.dll!*\n" |
963 "*!foo\n") | 999 "*!foo\n") |
964 assert str(supp) == supp_str, ( | 1000 assert str(supp) == supp_str, ( |
965 "str(supp) != supp_str:\nleft: %s\nright: %s" % (str(supp), supp_str)) | 1001 "str(supp) != supp_str:\nleft: %s\nright: %s" % (str(supp), supp_str)) |
966 | 1002 |
967 | 1003 |
968 if __name__ == '__main__': | 1004 if __name__ == '__main__': |
969 SelfTest() | 1005 SelfTest() |
970 print 'PASS' | 1006 print 'PASS' |
OLD | NEW |