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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 # actuals_base_url: base URL from which to read actual-result JSON files | 156 # actuals_base_url: base URL from which to read actual-result JSON files |
157 # actuals_filename: filename (under actuals_base_url) from which to read a | 157 # actuals_filename: filename (under actuals_base_url) from which to read a |
158 # summary of results; typically "actual-results.json" | 158 # summary of results; typically "actual-results.json" |
159 # exception_handler: reference to rebaseline.ExceptionHandler object | 159 # exception_handler: reference to rebaseline.ExceptionHandler object |
160 # tests: list of tests to rebaseline, or None if we should rebaseline | 160 # tests: list of tests to rebaseline, or None if we should rebaseline |
161 # whatever files the JSON results summary file tells us to | 161 # whatever files the JSON results summary file tells us to |
162 # configs: which configs to run for each test, or None if we should | 162 # configs: which configs to run for each test, or None if we should |
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 # add_ignored: if True, add expectations for tests for which failures are |
| 167 # currently ignored |
166 # bugs: optional list of bug numbers which pertain to these expectations | 168 # bugs: optional list of bug numbers which pertain to these expectations |
167 # notes: free-form text notes to add to all updated expectations | 169 # notes: free-form text notes to add to all updated expectations |
168 # mark_unreviewed: if True, mark these expectations as NOT having been | 170 # mark_unreviewed: if True, mark these expectations as NOT having been |
169 # reviewed by a human; otherwise, leave that field blank. | 171 # reviewed by a human; otherwise, leave that field blank. |
170 # Currently, there is no way to make this script mark | 172 # Currently, there is no way to make this script mark |
171 # expectations as reviewed-by-human=True. | 173 # expectations as reviewed-by-human=True. |
172 # TODO(epoger): Add that capability to a review tool. | 174 # TODO(epoger): Add that capability to a review tool. |
173 # mark_ignore_failure: if True, mark failures of a given test as being | 175 # mark_ignore_failure: if True, mark failures of a given test as being |
174 # ignored. | 176 # ignored. |
175 # from_trybot: if True, read actual-result JSON files generated from a | 177 # from_trybot: if True, read actual-result JSON files generated from a |
176 # trybot run rather than a waterfall run. | 178 # trybot run rather than a waterfall run. |
177 def __init__(self, expectations_root, expectations_input_filename, | 179 def __init__(self, expectations_root, expectations_input_filename, |
178 expectations_output_filename, actuals_base_url, | 180 expectations_output_filename, actuals_base_url, |
179 actuals_filename, exception_handler, | 181 actuals_filename, exception_handler, |
180 tests=None, configs=None, add_new=False, bugs=None, notes=None, | 182 tests=None, configs=None, add_new=False, add_ignored=False, |
181 mark_unreviewed=None, mark_ignore_failure=False, | 183 bugs=None, notes=None, mark_unreviewed=None, |
182 from_trybot=False): | 184 mark_ignore_failure=False, from_trybot=False): |
183 self._expectations_root = expectations_root | 185 self._expectations_root = expectations_root |
184 self._expectations_input_filename = expectations_input_filename | 186 self._expectations_input_filename = expectations_input_filename |
185 self._expectations_output_filename = expectations_output_filename | 187 self._expectations_output_filename = expectations_output_filename |
186 self._tests = tests | 188 self._tests = tests |
187 self._configs = configs | 189 self._configs = configs |
188 self._actuals_base_url = actuals_base_url | 190 self._actuals_base_url = actuals_base_url |
189 self._actuals_filename = actuals_filename | 191 self._actuals_filename = actuals_filename |
190 self._exception_handler = exception_handler | 192 self._exception_handler = exception_handler |
191 self._add_new = add_new | 193 self._add_new = add_new |
| 194 self._add_ignored = add_ignored |
192 self._bugs = bugs | 195 self._bugs = bugs |
193 self._notes = notes | 196 self._notes = notes |
194 self._mark_unreviewed = mark_unreviewed | 197 self._mark_unreviewed = mark_unreviewed |
195 self._mark_ignore_failure = mark_ignore_failure; | 198 self._mark_ignore_failure = mark_ignore_failure; |
196 if self._tests or self._configs: | 199 if self._tests or self._configs: |
197 self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) | 200 self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
198 else: | 201 else: |
199 self._image_filename_re = None | 202 self._image_filename_re = None |
200 self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) | 203 self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) |
201 self._from_trybot = from_trybot | 204 self._from_trybot = from_trybot |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 actuals_url = '/'.join([self._actuals_base_url, results_builder, | 277 actuals_url = '/'.join([self._actuals_base_url, results_builder, |
275 self._actuals_filename]) | 278 self._actuals_filename]) |
276 # Only update results for tests that are currently failing. | 279 # Only update results for tests that are currently failing. |
277 # We don't want to rewrite results for tests that are already succeeding, | 280 # We don't want to rewrite results for tests that are already succeeding, |
278 # because we don't want to add annotation fields (such as | 281 # because we don't want to add annotation fields (such as |
279 # JSONKEY_EXPECTEDRESULTS_BUGS) except for tests whose expectations we | 282 # JSONKEY_EXPECTEDRESULTS_BUGS) except for tests whose expectations we |
280 # are actually modifying. | 283 # are actually modifying. |
281 sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED] | 284 sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED] |
282 if self._add_new: | 285 if self._add_new: |
283 sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) | 286 sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) |
| 287 if self._add_ignored: |
| 288 sections.append(gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED) |
284 results_to_update = self._GetActualResults(json_url=actuals_url, | 289 results_to_update = self._GetActualResults(json_url=actuals_url, |
285 sections=sections) | 290 sections=sections) |
286 | 291 |
287 # Read in current expectations. | 292 # Read in current expectations. |
288 expectations_input_filepath = os.path.join( | 293 expectations_input_filepath = os.path.join( |
289 self._expectations_root, builder, self._expectations_input_filename) | 294 self._expectations_root, builder, self._expectations_input_filename) |
290 expectations_dict = gm_json.LoadFromFile(expectations_input_filepath) | 295 expectations_dict = gm_json.LoadFromFile(expectations_input_filepath) |
291 expected_results = expectations_dict.get(gm_json.JSONKEY_EXPECTEDRESULTS) | 296 expected_results = expectations_dict.get(gm_json.JSONKEY_EXPECTEDRESULTS) |
292 if not expected_results: | 297 if not expected_results: |
293 expected_results = {} | 298 expected_results = {} |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 parser.add_argument('--actuals-filename', | 363 parser.add_argument('--actuals-filename', |
359 help=('filename (within builder-specific subdirectories ' | 364 help=('filename (within builder-specific subdirectories ' |
360 'of ACTUALS_BASE_URL) to read a summary of results ' | 365 'of ACTUALS_BASE_URL) to read a summary of results ' |
361 'from; defaults to %(default)s'), | 366 'from; defaults to %(default)s'), |
362 default='actual-results.json') | 367 default='actual-results.json') |
363 parser.add_argument('--add-new', action='store_true', | 368 parser.add_argument('--add-new', action='store_true', |
364 help=('in addition to the standard behavior of ' | 369 help=('in addition to the standard behavior of ' |
365 'updating expectations for failing tests, add ' | 370 'updating expectations for failing tests, add ' |
366 'expectations for tests which don\'t have ' | 371 'expectations for tests which don\'t have ' |
367 'expectations yet.')) | 372 'expectations yet.')) |
| 373 parser.add_argument('--add-ignored', action='store_true', |
| 374 help=('in addition to the standard behavior of ' |
| 375 'updating expectations for failing tests, add ' |
| 376 'expectations for tests for which failures are ' |
| 377 'currently ignored.')) |
368 parser.add_argument('--bugs', metavar='BUG', type=int, nargs='+', | 378 parser.add_argument('--bugs', metavar='BUG', type=int, nargs='+', |
369 help=('Skia bug numbers (under ' | 379 help=('Skia bug numbers (under ' |
370 'https://code.google.com/p/skia/issues/list ) which ' | 380 'https://code.google.com/p/skia/issues/list ) which ' |
371 'pertain to this set of rebaselines.')) | 381 'pertain to this set of rebaselines.')) |
372 parser.add_argument('--builders', metavar='BUILDER', nargs='+', | 382 parser.add_argument('--builders', metavar='BUILDER', nargs='+', |
373 help=('which platforms to rebaseline; ' | 383 help=('which platforms to rebaseline; ' |
374 'if unspecified, rebaseline all known platforms ' | 384 'if unspecified, rebaseline all known platforms ' |
375 '(see below for a list)')) | 385 '(see below for a list)')) |
376 # TODO(epoger): Add test that exercises --configs argument. | 386 # TODO(epoger): Add test that exercises --configs argument. |
377 parser.add_argument('--configs', metavar='CONFIG', nargs='+', | 387 parser.add_argument('--configs', metavar='CONFIG', nargs='+', |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 if os.path.isfile(expectations_json_file): | 468 if os.path.isfile(expectations_json_file): |
459 rebaseliner = JsonRebaseliner( | 469 rebaseliner = JsonRebaseliner( |
460 expectations_root=args.expectations_root, | 470 expectations_root=args.expectations_root, |
461 expectations_input_filename=args.expectations_filename, | 471 expectations_input_filename=args.expectations_filename, |
462 expectations_output_filename=(args.expectations_filename_output or | 472 expectations_output_filename=(args.expectations_filename_output or |
463 args.expectations_filename), | 473 args.expectations_filename), |
464 tests=args.tests, configs=args.configs, | 474 tests=args.tests, configs=args.configs, |
465 actuals_base_url=args.actuals_base_url, | 475 actuals_base_url=args.actuals_base_url, |
466 actuals_filename=args.actuals_filename, | 476 actuals_filename=args.actuals_filename, |
467 exception_handler=exception_handler, | 477 exception_handler=exception_handler, |
468 add_new=args.add_new, bugs=args.bugs, notes=args.notes, | 478 add_new=args.add_new, add_ignored=args.add_ignored, |
| 479 bugs=args.bugs, notes=args.notes, |
469 mark_unreviewed=args.unreviewed, | 480 mark_unreviewed=args.unreviewed, |
470 mark_ignore_failure=args.ignore_failure, | 481 mark_ignore_failure=args.ignore_failure, |
471 from_trybot=args.from_trybot) | 482 from_trybot=args.from_trybot) |
472 try: | 483 try: |
473 rebaseliner.RebaselineSubdir(builder=builder) | 484 rebaseliner.RebaselineSubdir(builder=builder) |
474 except: | 485 except: |
475 exception_handler.RaiseExceptionOrContinue() | 486 exception_handler.RaiseExceptionOrContinue() |
476 else: | 487 else: |
477 try: | 488 try: |
478 raise _InternalException('expectations_json_file %s not found' % | 489 raise _InternalException('expectations_json_file %s not found' % |
479 expectations_json_file) | 490 expectations_json_file) |
480 except: | 491 except: |
481 exception_handler.RaiseExceptionOrContinue() | 492 exception_handler.RaiseExceptionOrContinue() |
482 | 493 |
483 exception_handler.ReportAllFailures() | 494 exception_handler.ReportAllFailures() |
OLD | NEW |