| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 # heapcheck_test.py | 6 # heapcheck_test.py |
| 7 | 7 |
| 8 """Wrapper for running the test under heapchecker and analyzing the output.""" | 8 """Wrapper for running the test under heapchecker and analyzing the output.""" |
| 9 | 9 |
| 10 import datetime | 10 import datetime |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 print 'Aborting...' | 116 print 'Aborting...' |
| 117 return 3 | 117 return 3 |
| 118 # Print the report and set the return code to 1. | 118 # Print the report and set the return code to 1. |
| 119 print ('Leak of %d bytes in %d objects allocated from:' | 119 print ('Leak of %d bytes in %d objects allocated from:' |
| 120 % tuple(cur_leak_signature)) | 120 % tuple(cur_leak_signature)) |
| 121 print '\n'.join(cur_report) | 121 print '\n'.join(cur_report) |
| 122 return_code = 1 | 122 return_code = 1 |
| 123 # Generate the suppression iff the stack contains more than one | 123 # Generate the suppression iff the stack contains more than one |
| 124 # frame (otherwise it's likely to be broken) | 124 # frame (otherwise it's likely to be broken) |
| 125 if len(cur_stack) > 1: | 125 if len(cur_stack) > 1: |
| 126 print '\nSuppression:\n{' | 126 print '\nSuppression (error hash=#%016X#):\n{' \ |
| 127 % (hash("".join(cur_stack)) & 0xffffffffffffffff) |
| 127 print ' <insert_a_suppression_name_here>' | 128 print ' <insert_a_suppression_name_here>' |
| 128 print ' Heapcheck:Leak' | 129 print ' Heapcheck:Leak' |
| 129 for frame in cur_stack: | 130 for frame in cur_stack: |
| 130 print ' fun:' + frame | 131 print ' fun:' + frame |
| 131 print '}\n\n\n' | 132 print '}\n\n\n' |
| 132 else: | 133 else: |
| 133 print ('This stack may be broken due to omitted frame pointers. ' | 134 print ('This stack may be broken due to omitted frame pointers. ' |
| 134 'It is not recommended to suppress it.') | 135 'It is not recommended to suppress it.') |
| 135 else: | 136 else: |
| 136 # Update the suppressions histogram. | 137 # Update the suppressions histogram. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 'http://dev.chromium.org/developers/how-tos/' | 203 'http://dev.chromium.org/developers/how-tos/' |
| 203 'using-the-heap-leak-checker') | 204 'using-the-heap-leak-checker') |
| 204 return retcode | 205 return retcode |
| 205 | 206 |
| 206 | 207 |
| 207 def RunTool(args, supp_files, module): | 208 def RunTool(args, supp_files, module): |
| 208 tool = HeapcheckWrapper(supp_files) | 209 tool = HeapcheckWrapper(supp_files) |
| 209 MODULES_TO_SANITY_CHECK = ["base"] | 210 MODULES_TO_SANITY_CHECK = ["base"] |
| 210 check_sanity = module in MODULES_TO_SANITY_CHECK | 211 check_sanity = module in MODULES_TO_SANITY_CHECK |
| 211 return tool.Main(args[1:], check_sanity) | 212 return tool.Main(args[1:], check_sanity) |
| OLD | NEW |