| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The PDFium Authors. All rights reserved. | 2 # Copyright 2016 The PDFium 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 import cStringIO | 6 import cStringIO |
| 7 import functools | 7 import functools |
| 8 import multiprocessing | 8 import multiprocessing |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 cmd_to_run = common.DrMemoryWrapper(self.drmem_wrapper, input_root) | 120 cmd_to_run = common.DrMemoryWrapper(self.drmem_wrapper, input_root) |
| 121 cmd_to_run.extend([self.pdfium_test_path, '--send-events', '--png']) | 121 cmd_to_run.extend([self.pdfium_test_path, '--send-events', '--png']) |
| 122 if self.gold_results: | 122 if self.gold_results: |
| 123 cmd_to_run.append('--md5') | 123 cmd_to_run.append('--md5') |
| 124 cmd_to_run.append(pdf_path) | 124 cmd_to_run.append(pdf_path) |
| 125 return common.RunCommandExtractHashedFiles(cmd_to_run) | 125 return common.RunCommandExtractHashedFiles(cmd_to_run) |
| 126 | 126 |
| 127 def HandleResult(self, input_filename, input_path, result): | 127 def HandleResult(self, input_filename, input_path, result): |
| 128 if self.gold_results: | 128 if self.gold_results: |
| 129 success, image_paths = result | 129 success, image_paths = result |
| 130 for img_path, md5_hash in image_paths: | 130 if image_paths: |
| 131 # the output filename (without extension becomes the test name) | 131 for img_path, md5_hash in image_paths: |
| 132 test_name = os.path.splitext(os.path.split(img_path)[1])[0] | 132 # the output filename (without extension becomes the test name) |
| 133 self.gold_results.AddTestResult(test_name, md5_hash, img_path) | 133 test_name = os.path.splitext(os.path.split(img_path)[1])[0] |
| 134 self.gold_results.AddTestResult(test_name, md5_hash, img_path) |
| 134 | 135 |
| 135 if self.test_suppressor.IsResultSuppressed(input_filename): | 136 if self.test_suppressor.IsResultSuppressed(input_filename): |
| 136 if result: | 137 if result: |
| 137 self.surprises.append(input_path) | 138 self.surprises.append(input_path) |
| 138 else: | 139 else: |
| 139 if not result: | 140 if not result: |
| 140 self.failures.append(input_path) | 141 self.failures.append(input_path) |
| 141 | 142 |
| 142 | 143 |
| 143 def Run(self): | 144 def Run(self): |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 print surprise; | 263 print surprise; |
| 263 | 264 |
| 264 if self.failures: | 265 if self.failures: |
| 265 self.failures.sort() | 266 self.failures.sort() |
| 266 print '\n\nSummary of Failures:' | 267 print '\n\nSummary of Failures:' |
| 267 for failure in self.failures: | 268 for failure in self.failures: |
| 268 print failure | 269 print failure |
| 269 if not options.ignore_errors: | 270 if not options.ignore_errors: |
| 270 return 1 | 271 return 1 |
| 271 return 0 | 272 return 0 |
| OLD | NEW |