OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 from third_party import asan_symbolize | 7 from third_party import asan_symbolize |
8 | 8 |
9 import argparse | 9 import argparse |
10 import base64 | 10 import base64 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 original_snippet = base64.b64decode(test_run['output_snippet_base64']) | 177 original_snippet = base64.b64decode(test_run['output_snippet_base64']) |
178 symbolized_snippet = self.symbolize_snippet(original_snippet) | 178 symbolized_snippet = self.symbolize_snippet(original_snippet) |
179 if symbolized_snippet == original_snippet: | 179 if symbolized_snippet == original_snippet: |
180 # No sanitizer reports in snippet. | 180 # No sanitizer reports in snippet. |
181 return | 181 return |
182 | 182 |
183 test_run['original_output_snippet'] = test_run['output_snippet'] | 183 test_run['original_output_snippet'] = test_run['output_snippet'] |
184 test_run['original_output_snippet_base64'] = \ | 184 test_run['original_output_snippet_base64'] = \ |
185 test_run['output_snippet_base64'] | 185 test_run['output_snippet_base64'] |
186 | 186 |
187 test_run['output_snippet'] = symbolized_snippet | 187 test_run['output_snippet'] = symbolized_snippet.decode('utf-8', 'replace') |
188 test_run['output_snippet_base64'] = \ | 188 test_run['output_snippet_base64'] = \ |
189 base64.b64encode(symbolized_snippet) | 189 base64.b64encode(symbolized_snippet) |
190 test_run['snippet_processed_by'] = 'asan_symbolize.py' | 190 test_run['snippet_processed_by'] = 'asan_symbolize.py' |
191 | 191 |
192 | 192 |
193 def symbolize_snippets_in_json(filename, symbolization_loop): | 193 def symbolize_snippets_in_json(filename, symbolization_loop): |
194 with open(filename, 'r') as f: | 194 with open(filename, 'r') as f: |
195 json_data = json.load(f) | 195 json_data = json.load(f) |
196 | 196 |
197 test_run_symbolizer = JSONTestRunSymbolizer(symbolization_loop) | 197 test_run_symbolizer = JSONTestRunSymbolizer(symbolization_loop) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 if args.test_summary_json_file: | 237 if args.test_summary_json_file: |
238 symbolize_snippets_in_json(args.test_summary_json_file, loop) | 238 symbolize_snippets_in_json(args.test_summary_json_file, loop) |
239 else: | 239 else: |
240 # Process stdin. | 240 # Process stdin. |
241 asan_symbolize.logfile = sys.stdin | 241 asan_symbolize.logfile = sys.stdin |
242 loop.process_logfile() | 242 loop.process_logfile() |
243 | 243 |
244 if __name__ == '__main__': | 244 if __name__ == '__main__': |
245 main() | 245 main() |
OLD | NEW |