OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 ''' | 3 ''' |
4 Copyright 2012 Google Inc. | 4 Copyright 2012 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 ''' | 8 ''' |
9 | 9 |
10 ''' | 10 ''' |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 # rebaseline whatever configs the JSON results summary file tells | 163 # rebaseline whatever configs the JSON results summary file tells |
164 # us to | 164 # us to |
165 # add_new: if True, add expectations for tests which don't have any yet | 165 # add_new: if True, add expectations for tests which don't have any yet |
166 # bugs: optional list of bug numbers which pertain to these expectations | 166 # bugs: optional list of bug numbers which pertain to these expectations |
167 # notes: free-form text notes to add to all updated expectations | 167 # notes: free-form text notes to add to all updated expectations |
168 # mark_unreviewed: if True, mark these expectations as NOT having been | 168 # mark_unreviewed: if True, mark these expectations as NOT having been |
169 # reviewed by a human; otherwise, leave that field blank. | 169 # reviewed by a human; otherwise, leave that field blank. |
170 # Currently, there is no way to make this script mark | 170 # Currently, there is no way to make this script mark |
171 # expectations as reviewed-by-human=True. | 171 # expectations as reviewed-by-human=True. |
172 # TODO(epoger): Add that capability to a review tool. | 172 # TODO(epoger): Add that capability to a review tool. |
| 173 # mark_ignore_failure: if True, mark failures of a given test as being |
| 174 # ignored. |
173 def __init__(self, expectations_root, expectations_input_filename, | 175 def __init__(self, expectations_root, expectations_input_filename, |
174 expectations_output_filename, actuals_base_url, | 176 expectations_output_filename, actuals_base_url, |
175 actuals_filename, exception_handler, | 177 actuals_filename, exception_handler, |
176 tests=None, configs=None, add_new=False, bugs=None, notes=None, | 178 tests=None, configs=None, add_new=False, bugs=None, notes=None, |
177 mark_unreviewed=None, from_trybot=False): | 179 mark_unreviewed=None, mark_ignore_failure=False, |
| 180 from_trybot=False): |
178 self._expectations_root = expectations_root | 181 self._expectations_root = expectations_root |
179 self._expectations_input_filename = expectations_input_filename | 182 self._expectations_input_filename = expectations_input_filename |
180 self._expectations_output_filename = expectations_output_filename | 183 self._expectations_output_filename = expectations_output_filename |
181 self._tests = tests | 184 self._tests = tests |
182 self._configs = configs | 185 self._configs = configs |
183 self._actuals_base_url = actuals_base_url | 186 self._actuals_base_url = actuals_base_url |
184 self._actuals_filename = actuals_filename | 187 self._actuals_filename = actuals_filename |
185 self._exception_handler = exception_handler | 188 self._exception_handler = exception_handler |
186 self._add_new = add_new | 189 self._add_new = add_new |
187 self._bugs = bugs | 190 self._bugs = bugs |
188 self._notes = notes | 191 self._notes = notes |
189 self._mark_unreviewed = mark_unreviewed | 192 self._mark_unreviewed = mark_unreviewed |
| 193 self._mark_ignore_failure = mark_ignore_failure; |
190 self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) | 194 self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
191 self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) | 195 self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) |
192 self._from_trybot = from_trybot | 196 self._from_trybot = from_trybot |
193 | 197 |
194 # Executes subprocess.call(cmd). | 198 # Executes subprocess.call(cmd). |
195 # Raises an Exception if the command fails. | 199 # Raises an Exception if the command fails. |
196 def _Call(self, cmd): | 200 def _Call(self, cmd): |
197 if subprocess.call(cmd) != 0: | 201 if subprocess.call(cmd) != 0: |
198 raise _InternalException('error running command: ' + ' '.join(cmd)) | 202 raise _InternalException('error running command: ' + ' '.join(cmd)) |
199 | 203 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 continue | 304 continue |
301 if not expected_results.get(image_name): | 305 if not expected_results.get(image_name): |
302 expected_results[image_name] = {} | 306 expected_results[image_name] = {} |
303 expected_results[image_name]\ | 307 expected_results[image_name]\ |
304 [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS]\ | 308 [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS]\ |
305 = [image_results] | 309 = [image_results] |
306 if self._mark_unreviewed: | 310 if self._mark_unreviewed: |
307 expected_results[image_name]\ | 311 expected_results[image_name]\ |
308 [gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED]\ | 312 [gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED]\ |
309 = False | 313 = False |
| 314 if self._mark_ignore_failure: |
| 315 expected_results[image_name]\ |
| 316 [gm_json.JSONKEY_EXPECTEDRESULTS_IGNOREFAILURE]\ |
| 317 = True |
310 if self._bugs: | 318 if self._bugs: |
311 expected_results[image_name]\ | 319 expected_results[image_name]\ |
312 [gm_json.JSONKEY_EXPECTEDRESULTS_BUGS]\ | 320 [gm_json.JSONKEY_EXPECTEDRESULTS_BUGS]\ |
313 = self._bugs | 321 = self._bugs |
314 if self._notes: | 322 if self._notes: |
315 expected_results[image_name]\ | 323 expected_results[image_name]\ |
316 [gm_json.JSONKEY_EXPECTEDRESULTS_NOTES]\ | 324 [gm_json.JSONKEY_EXPECTEDRESULTS_NOTES]\ |
317 = self._notes | 325 = self._notes |
318 | 326 |
319 # Write out updated expectations. | 327 # Write out updated expectations. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 parser.add_argument('--tests', metavar='TEST', nargs='+', | 399 parser.add_argument('--tests', metavar='TEST', nargs='+', |
392 help=('which tests to rebaseline, e.g. ' | 400 help=('which tests to rebaseline, e.g. ' |
393 '"--tests aaclip bigmatrix", as a filter over the ' | 401 '"--tests aaclip bigmatrix", as a filter over the ' |
394 'full set of results in ACTUALS_FILENAME; if ' | 402 'full set of results in ACTUALS_FILENAME; if ' |
395 'unspecified, rebaseline *all* tests that are ' | 403 'unspecified, rebaseline *all* tests that are ' |
396 'available.')) | 404 'available.')) |
397 parser.add_argument('--unreviewed', action='store_true', | 405 parser.add_argument('--unreviewed', action='store_true', |
398 help=('mark all expectations modified by this run as ' | 406 help=('mark all expectations modified by this run as ' |
399 '"%s": False' % | 407 '"%s": False' % |
400 gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED)) | 408 gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED)) |
| 409 parser.add_argument('--ignore-failure', action='store_true', |
| 410 help=('mark all expectations modified by this run as ' |
| 411 '"%s": True' % |
| 412 gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED)) |
401 parser.add_argument('--from-trybot', action='store_true', | 413 parser.add_argument('--from-trybot', action='store_true', |
402 help=('pull the actual-results.json file from the ' | 414 help=('pull the actual-results.json file from the ' |
403 'corresponding trybot, rather than the main builder')) | 415 'corresponding trybot, rather than the main builder')) |
404 args = parser.parse_args() | 416 args = parser.parse_args() |
405 exception_handler = ExceptionHandler( | 417 exception_handler = ExceptionHandler( |
406 keep_going_on_failure=args.keep_going_on_failure) | 418 keep_going_on_failure=args.keep_going_on_failure) |
407 if args.builders: | 419 if args.builders: |
408 builders = args.builders | 420 builders = args.builders |
409 missing_json_is_fatal = True | 421 missing_json_is_fatal = True |
410 else: | 422 else: |
(...skipping 12 matching lines...) Expand all Loading... |
423 expectations_root=args.expectations_root, | 435 expectations_root=args.expectations_root, |
424 expectations_input_filename=args.expectations_filename, | 436 expectations_input_filename=args.expectations_filename, |
425 expectations_output_filename=(args.expectations_filename_output or | 437 expectations_output_filename=(args.expectations_filename_output or |
426 args.expectations_filename), | 438 args.expectations_filename), |
427 tests=args.tests, configs=args.configs, | 439 tests=args.tests, configs=args.configs, |
428 actuals_base_url=args.actuals_base_url, | 440 actuals_base_url=args.actuals_base_url, |
429 actuals_filename=args.actuals_filename, | 441 actuals_filename=args.actuals_filename, |
430 exception_handler=exception_handler, | 442 exception_handler=exception_handler, |
431 add_new=args.add_new, bugs=args.bugs, notes=args.notes, | 443 add_new=args.add_new, bugs=args.bugs, notes=args.notes, |
432 mark_unreviewed=args.unreviewed, | 444 mark_unreviewed=args.unreviewed, |
| 445 mark_ignore_failure=args.ignore_failure, |
433 from_trybot=args.from_trybot) | 446 from_trybot=args.from_trybot) |
434 try: | 447 try: |
435 rebaseliner.RebaselineSubdir(builder=builder) | 448 rebaseliner.RebaselineSubdir(builder=builder) |
436 except: | 449 except: |
437 exception_handler.RaiseExceptionOrContinue() | 450 exception_handler.RaiseExceptionOrContinue() |
438 else: | 451 else: |
439 try: | 452 try: |
440 raise _InternalException('expectations_json_file %s not found' % | 453 raise _InternalException('expectations_json_file %s not found' % |
441 expectations_json_file) | 454 expectations_json_file) |
442 except: | 455 except: |
443 exception_handler.RaiseExceptionOrContinue() | 456 exception_handler.RaiseExceptionOrContinue() |
444 | 457 |
445 exception_handler.ReportAllFailures() | 458 exception_handler.ReportAllFailures() |
OLD | NEW |