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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 if self.line_.startswith("ASSERT FAILURE"): | 133 if self.line_.startswith("ASSERT FAILURE"): |
134 ret.append(self.line_.strip()) | 134 ret.append(self.line_.strip()) |
135 | 135 |
136 self.cur_fd_.close() | 136 self.cur_fd_.close() |
137 return ret | 137 return ret |
138 | 138 |
139 def Report(self, filenames, testcase, check_sanity): | 139 def Report(self, filenames, testcase, check_sanity): |
140 sys.stdout.flush() | 140 sys.stdout.flush() |
141 # TODO(timurrrr): support positive tests / check_sanity==True | 141 # TODO(timurrrr): support positive tests / check_sanity==True |
| 142 self.used_suppressions = defaultdict(int) |
142 | 143 |
143 to_report = [] | 144 to_report = [] |
144 self.used_suppressions = defaultdict(int) | 145 reports_for_this_test = set() |
145 for f in filenames: | 146 for f in filenames: |
146 cur_reports = self.ParseReportFile(f, testcase) | 147 cur_reports = self.ParseReportFile(f, testcase) |
147 | 148 |
148 # Filter out the reports that were there in previous tests. | 149 # Filter out the reports that were there in previous tests. |
149 for r in cur_reports: | 150 for r in cur_reports: |
150 if r in self.known_errors: | 151 if r in reports_for_this_test: |
151 pass # TODO: print out a hash once we add hashes to the reports. | 152 # A similar report is about to be printed for this test. |
| 153 pass |
| 154 elif r in self.known_errors: |
| 155 # A similar report has already been printed in one of the prev tests. |
| 156 to_report.append("This error was already printed in some " |
| 157 "other test, see 'hash=#%016X#'" % r.ErrorHash()) |
| 158 reports_for_this_test.add(r) |
152 else: | 159 else: |
153 self.known_errors.add(r) | 160 self.known_errors.add(r) |
| 161 reports_for_this_test.add(r) |
154 to_report.append(r) | 162 to_report.append(r) |
155 | 163 |
156 common.PrintUsedSuppressionsList(self.used_suppressions) | 164 common.PrintUsedSuppressionsList(self.used_suppressions) |
157 | 165 |
158 if not to_report: | 166 if not to_report: |
159 logging.info("PASS: No error reports found") | 167 logging.info("PASS: No error reports found") |
160 return 0 | 168 return 0 |
161 | 169 |
162 logging.error("Found %i error reports" % len(to_report)) | 170 logging.error("Found %i error reports" % len(to_report)) |
163 sys.stderr.flush() | 171 sys.stderr.flush() |
(...skipping 17 matching lines...) Expand all Loading... |
181 if len(args) == 0: | 189 if len(args) == 0: |
182 parser.error("no filename specified") | 190 parser.error("no filename specified") |
183 filenames = args | 191 filenames = args |
184 | 192 |
185 logging.getLogger().setLevel(logging.INFO) | 193 logging.getLogger().setLevel(logging.INFO) |
186 return DrMemoryAnalyzer().Report(filenames, None, False) | 194 return DrMemoryAnalyzer().Report(filenames, None, False) |
187 | 195 |
188 | 196 |
189 if __name__ == '__main__': | 197 if __name__ == '__main__': |
190 sys.exit(main()) | 198 sys.exit(main()) |
OLD | NEW |