Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: testing/tools/test_runner.py

Issue 2649313005: Add flag to ignore images by their MD5 digest (Closed)
Patch Set: Removed debug statement Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/tools/gold.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 parser.add_option('--gold_properties', default='', dest="gold_properties", 157 parser.add_option('--gold_properties', default='', dest="gold_properties",
158 help='Key value pairs that are written to the top level of the JSON file that is ingested by Gold.') 158 help='Key value pairs that are written to the top level of the JSON file that is ingested by Gold.')
159 159
160 parser.add_option('--gold_key', default='', dest="gold_key", 160 parser.add_option('--gold_key', default='', dest="gold_key",
161 help='Key value pairs that are added to the "key" field of the JSON file that is ingested by Gold.') 161 help='Key value pairs that are added to the "key" field of the JSON file that is ingested by Gold.')
162 162
163 parser.add_option('--gold_output_dir', default='', dest="gold_output_dir", 163 parser.add_option('--gold_output_dir', default='', dest="gold_output_dir",
164 help='Path of where to write the JSON output to be uploade d to Gold.') 164 help='Path of where to write the JSON output to be uploade d to Gold.')
165 165
166 parser.add_option('--gold_ignore_hashes', default='', dest="gold_ignore_hash es",
167 help='Path to a file with MD5 hashes we wish to ignore.')
168
166 parser.add_option('--ignore_errors', action="store_true", dest="ignore_error s", 169 parser.add_option('--ignore_errors', action="store_true", dest="ignore_error s",
167 help='Prevents the return value from being non-zero when i mage comparison fails.') 170 help='Prevents the return value from being non-zero when i mage comparison fails.')
168 171
169 options, args = parser.parse_args() 172 options, args = parser.parse_args()
170 173
171 finder = common.DirectoryFinder(options.build_dir) 174 finder = common.DirectoryFinder(options.build_dir)
172 self.fixup_path = finder.ScriptPath('fixup_pdf_template.py') 175 self.fixup_path = finder.ScriptPath('fixup_pdf_template.py')
173 self.text_diff_path = finder.ScriptPath('text_diff.py') 176 self.text_diff_path = finder.ScriptPath('text_diff.py')
174 177
175 self.drmem_wrapper = options.wrapper 178 self.drmem_wrapper = options.wrapper
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 223
221 self.failures = [] 224 self.failures = []
222 self.surprises = [] 225 self.surprises = []
223 226
224 # Collect Gold results if an output directory was named. 227 # Collect Gold results if an output directory was named.
225 self.gold_results = None 228 self.gold_results = None
226 if options.gold_output_dir: 229 if options.gold_output_dir:
227 self.gold_results = gold.GoldResults("pdfium", 230 self.gold_results = gold.GoldResults("pdfium",
228 options.gold_output_dir, 231 options.gold_output_dir,
229 options.gold_properties, 232 options.gold_properties,
230 options.gold_key) 233 options.gold_key,
234 options.gold_ignore_hashes)
231 235
232 if options.num_workers > 1 and len(test_cases) > 1: 236 if options.num_workers > 1 and len(test_cases) > 1:
233 try: 237 try:
234 pool = multiprocessing.Pool(options.num_workers) 238 pool = multiprocessing.Pool(options.num_workers)
235 worker_func = functools.partial(TestOneFileParallel, self) 239 worker_func = functools.partial(TestOneFileParallel, self)
236 240
237 worker_results = pool.imap(worker_func, test_cases) 241 worker_results = pool.imap(worker_func, test_cases)
238 for worker_result in worker_results: 242 for worker_result in worker_results:
239 result, input_filename, source_dir = worker_result 243 result, input_filename, source_dir = worker_result
240 input_path = os.path.join(source_dir, input_filename) 244 input_path = os.path.join(source_dir, input_filename)
(...skipping 22 matching lines...) Expand all
263 print surprise; 267 print surprise;
264 268
265 if self.failures: 269 if self.failures:
266 self.failures.sort() 270 self.failures.sort()
267 print '\n\nSummary of Failures:' 271 print '\n\nSummary of Failures:'
268 for failure in self.failures: 272 for failure in self.failures:
269 print failure 273 print failure
270 if not options.ignore_errors: 274 if not options.ignore_errors:
271 return 1 275 return 1
272 return 0 276 return 0
OLDNEW
« no previous file with comments | « testing/tools/gold.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698