Chromium Code Reviews| Index: tools/rebaseline.py |
| =================================================================== |
| --- tools/rebaseline.py (revision 11009) |
| +++ tools/rebaseline.py (working copy) |
| @@ -160,10 +160,18 @@ |
| # rebaseline whatever configs the JSON results summary file tells |
| # us to |
| # add_new: if True, add expectations for tests which don't have any yet |
| + # bugs: optional list of bug numbers which pertain to these expectations |
| + # notes: free-form text notes to add to all updated expectations |
| + # mark_unreviewed: if True, mark these expectations as NOT having been |
| + # reviewed by a human; otherwise, leave that field blank. |
| + # Currently, there is no way to make this script mark |
| + # expectations as reviewed-by-human=True. |
| + # TODO(epoger): Add that capability to a review tool. |
| def __init__(self, expectations_root, expectations_input_filename, |
| expectations_output_filename, actuals_base_url, |
| actuals_filename, exception_handler, |
| - tests=None, configs=None, add_new=False): |
| + tests=None, configs=None, add_new=False, bugs=None, notes=None, |
| + mark_unreviewed=None): |
| self._expectations_root = expectations_root |
| self._expectations_input_filename = expectations_input_filename |
| self._expectations_output_filename = expectations_output_filename |
| @@ -173,6 +181,9 @@ |
| self._actuals_filename = actuals_filename |
| self._exception_handler = exception_handler |
| self._add_new = add_new |
| + self._bugs = bugs |
| + self._notes = notes |
| + self._mark_unreviewed = mark_unreviewed |
| self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
| self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) |
| @@ -246,11 +257,12 @@ |
| # results we need to update. |
| actuals_url = '/'.join([self._actuals_base_url, |
| builder, self._actuals_filename]) |
| - # In most cases, we won't need to re-record results that are already |
| - # succeeding, but including the SUCCEEDED results will allow us to |
| - # re-record expectations if they somehow get out of sync. |
| - sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED, |
| - gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED] |
| + # Only update results for tests that are currently failing. |
| + # We don't want to rewrite results for tests that are already succeeding, |
| + # because we don't want to add annotation fields (such as |
| + # JSONKEY_EXPECTEDRESULTS_BUGS) except for tests whose expectations we |
| + # are actually modifying. |
| + sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED] |
| if self._add_new: |
| sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) |
| results_to_update = self._GetActualResults(json_url=actuals_url, |
| @@ -280,6 +292,15 @@ |
| expected_results[image_name] = {} |
| expected_results[image_name][gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \ |
| [image_results] |
| + if self._mark_unreviewed: |
| + expected_results[image_name][gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED] = \ |
|
borenet
2013/08/30 13:26:55
Nit: 80 chars
epoger
2013/08/30 14:50:15
Yes, but for these lines (as well as line 293 abov
borenet
2013/09/03 15:42:53
Maybe something like this?
if self._mark_unreview
epoger
2013/09/03 17:28:14
I took that idea and ran with it. What do you thi
borenet
2013/09/03 17:30:57
LGTM. Are the backslashes required?
|
| + False |
| + if self._bugs: |
| + expected_results[image_name][gm_json.JSONKEY_EXPECTEDRESULTS_BUGS] = \ |
| + self._bugs |
| + if self._notes: |
|
epoger
2013/08/30 09:18:25
Patchset 4 adds --notes flag, and records those no
|
| + expected_results[image_name][gm_json.JSONKEY_EXPECTEDRESULTS_NOTES] = \ |
|
borenet
2013/08/30 13:26:55
80 chars
|
| + self._notes |
| # Write out updated expectations. |
| expectations_output_filepath = os.path.join( |
| @@ -310,6 +331,10 @@ |
| 'updating expectations for failing tests, add ' + |
| 'expectations for tests which don\'t have expectations ' + |
| 'yet.') |
| +parser.add_argument('--bugs', metavar='BUG', type=int, nargs='+', |
| + help='Skia bug numbers (under ' + |
| + 'https://code.google.com/p/skia/issues/list ) which '+ |
| + 'pertain to this set of rebaselines.') |
|
borenet
2013/09/03 15:42:53
I'd prefer this syntax for multi-line strings:
pa
epoger
2013/09/03 17:28:14
Done.
|
| parser.add_argument('--builders', metavar='BUILDER', nargs='+', |
| help='which platforms to rebaseline; ' + |
| 'if unspecified, rebaseline all platforms, same as ' + |
| @@ -341,12 +366,18 @@ |
| help='instead of halting at the first error encountered, ' + |
| 'keep going and rebaseline as many tests as possible, ' + |
| 'and then report the full set of errors at the end') |
| +parser.add_argument('--notes', |
| + help='free-form text notes to add to all updated ' + |
| + 'expectations') |
| # TODO(epoger): Add test that exercises --tests argument. |
| parser.add_argument('--tests', metavar='TEST', nargs='+', |
| help='which tests to rebaseline, e.g. ' + |
| '"--tests aaclip bigmatrix", as a filter over the full ' + |
| 'set of results in ACTUALS_FILENAME; if unspecified, ' + |
| 'rebaseline *all* tests that are available.') |
| +parser.add_argument('--unreviewed', action='store_true', |
| + help='mark all expectations modified by this run as ' + |
| + '"%s": False' % gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED) |
| args = parser.parse_args() |
| exception_handler = ExceptionHandler( |
| keep_going_on_failure=args.keep_going_on_failure) |
| @@ -374,7 +405,8 @@ |
| actuals_base_url=args.actuals_base_url, |
| actuals_filename=args.actuals_filename, |
| exception_handler=exception_handler, |
| - add_new=args.add_new) |
| + add_new=args.add_new, bugs=args.bugs, notes=args.notes, |
| + mark_unreviewed=args.unreviewed) |
| try: |
| rebaseliner.RebaselineSubdir(builder=builder) |
| except BaseException as e: |