OLD | NEW |
1 #!/usr/bin/env 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 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 self.known_errors.add(r) | 150 self.known_errors.add(r) |
151 to_report.append(r) | 151 to_report.append(r) |
152 | 152 |
153 common.PrintUsedSuppressionsList(self.used_suppressions) | 153 common.PrintUsedSuppressionsList(self.used_suppressions) |
154 | 154 |
155 if not to_report: | 155 if not to_report: |
156 logging.info("PASS: No error reports found") | 156 logging.info("PASS: No error reports found") |
157 return 0 | 157 return 0 |
158 | 158 |
159 logging.error("Found %i error reports" % len(to_report)) | 159 logging.error("Found %i error reports" % len(to_report)) |
| 160 sys.stderr.flush() |
160 for report in to_report: | 161 for report in to_report: |
161 self.error_count += 1 | 162 self.error_count += 1 |
162 logging.error("Report #%d\n%s" % (self.error_count, report)) | 163 logging.info("Report #%d\n%s" % (self.error_count, report)) |
| 164 sys.stdout.flush() |
163 logging.error("Total: %i error reports" % len(to_report)) | 165 logging.error("Total: %i error reports" % len(to_report)) |
164 sys.stderr.flush() | 166 sys.stderr.flush() |
165 return -1 | 167 return -1 |
166 | 168 |
167 | 169 |
168 def main(): | 170 def main(): |
169 '''For testing only. The DrMemoryAnalyze class should be imported instead.''' | 171 '''For testing only. The DrMemoryAnalyze class should be imported instead.''' |
170 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") | 172 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
171 parser.add_option("", "--source_dir", | 173 parser.add_option("", "--source_dir", |
172 help="path to top of source tree for this build" | 174 help="path to top of source tree for this build" |
173 "(used to normalize source paths in baseline)") | 175 "(used to normalize source paths in baseline)") |
174 | 176 |
175 (options, args) = parser.parse_args() | 177 (options, args) = parser.parse_args() |
176 if len(args) == 0: | 178 if len(args) == 0: |
177 parser.error("no filename specified") | 179 parser.error("no filename specified") |
178 filenames = args | 180 filenames = args |
179 | 181 |
180 return DrMemoryAnalyzer().Report(filenames, None, False) | 182 return DrMemoryAnalyzer().Report(filenames, None, False) |
181 | 183 |
182 | 184 |
183 if __name__ == '__main__': | 185 if __name__ == '__main__': |
184 sys.exit(main()) | 186 sys.exit(main()) |
OLD | NEW |