| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 # drmemory_analyze.py | 6 # drmemory_analyze.py |
| 7 | 7 |
| 8 ''' Given a Dr. Memory output file, parses errors and uniques them.''' | 8 ''' Given a Dr. Memory output file, parses errors and uniques them.''' |
| 9 | 9 |
| 10 from collections import defaultdict | 10 from collections import defaultdict |
| 11 import common | 11 import common |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 logging.error("Found %i error reports" % len(to_report)) | 92 logging.error("Found %i error reports" % len(to_report)) |
| 93 for report in to_report: | 93 for report in to_report: |
| 94 if testcase: | 94 if testcase: |
| 95 logging.error("\n%s\nNote: observed on `%s`\n" % | 95 logging.error("\n%s\nNote: observed on `%s`\n" % |
| 96 (report, testcase)) | 96 (report, testcase)) |
| 97 else: | 97 else: |
| 98 logging.error("\n%s\n" % report) | 98 logging.error("\n%s\n" % report) |
| 99 logging.error("Total: %i error reports" % len(to_report)) | 99 logging.error("Total: %i error reports" % len(to_report)) |
| 100 return -1 | 100 return -1 |
| 101 | 101 |
| 102 if __name__ == '__main__': | 102 |
| 103 '''For testing only. The DrMemoryAnalyzer class should be imported instead.''' | 103 def main(): |
| 104 retcode = 0 | 104 '''For testing only. The DrMemoryAnalyze class should be imported instead.''' |
| 105 parser = optparse.OptionParser("usage: %prog <files to analyze>") | 105 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
| 106 parser.add_option("", "--source_dir", |
| 107 help="path to top of source tree for this build" |
| 108 "(used to normalize source paths in baseline)") |
| 109 |
| 106 (options, args) = parser.parse_args() | 110 (options, args) = parser.parse_args() |
| 107 if len(args) == 0: | 111 if len(args) == 0: |
| 108 parser.error("no filename specified") | 112 parser.error("no filename specified") |
| 109 filenames = args | 113 filenames = args |
| 110 | 114 |
| 111 analyzer = DrMemoryAnalyzer() | 115 return DrMemoryAnalyzer().Report(filenames, None, False) |
| 112 retcode = analyzer.Report(filenames, None, False) | |
| 113 | 116 |
| 114 sys.exit(retcode) | 117 |
| 118 if __name__ == '__main__': |
| 119 sys.exit(main()) |
| OLD | NEW |