Index: tools/rebaseline.py |
diff --git a/tools/rebaseline.py b/tools/rebaseline.py |
index 275d84ebed1ff56a9e21ff022ffb9bcef1d7497b..194cd55ca96ed9719dbe6ab0db1e233796647ecb 100755 |
--- a/tools/rebaseline.py |
+++ b/tools/rebaseline.py |
@@ -159,9 +159,11 @@ class JsonRebaseliner(object): |
# exception_handler: reference to rebaseline.ExceptionHandler object |
# tests: list of tests to rebaseline, or None if we should rebaseline |
# whatever files the JSON results summary file tells us to |
+ # Ignored if 'skip_pattern_matching' is set to True |
# configs: which configs to run for each test, or None if we should |
# rebaseline whatever configs the JSON results summary file tells |
# us to |
+ # Ignored if 'skip_pattern_matching' is set to True |
# 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 |
@@ -172,12 +174,14 @@ class JsonRebaseliner(object): |
# TODO(epoger): Add that capability to a review tool. |
# mark_ignore_failure: if True, mark failures of a given test as being |
# ignored. |
+ # skip_pattern_matching: if True, do not attempt to skip tests/configs |
+ # matching input parameters 'tests'/'configs'. |
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, bugs=None, notes=None, |
mark_unreviewed=None, mark_ignore_failure=False, |
- from_trybot=False): |
+ from_trybot=False, skip_pattern_matching=False): |
epoger
2013/10/10 19:51:39
Please add from_trybot to the docstring (I know yo
scroggo
2013/10/10 20:18:58
Done.
|
self._expectations_root = expectations_root |
self._expectations_input_filename = expectations_input_filename |
self._expectations_output_filename = expectations_output_filename |
@@ -191,7 +195,15 @@ class JsonRebaseliner(object): |
self._notes = notes |
self._mark_unreviewed = mark_unreviewed |
self._mark_ignore_failure = mark_ignore_failure; |
- self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
+ # TODO(scroggo): This is a hack. Since the filenames will not match |
+ # the pattern in skimage, we skip the pattern matching entirely. |
+ if skip_pattern_matching: |
epoger
2013/10/10 19:51:39
Maybe, instead of adding the new parameter that ca
scroggo
2013/10/10 20:18:58
Done. I like this much better!
|
+ self._image_filename_re = None |
+ if tests or configs: |
+ raise _InternalException('"skip_pattern_matching" is incompatible with ' |
+ '"tests" and "configs"') |
+ else: |
+ self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn')) |
self._from_trybot = from_trybot |
@@ -293,15 +305,16 @@ class JsonRebaseliner(object): |
skipped_images = [] |
if results_to_update: |
for (image_name, image_results) in results_to_update.iteritems(): |
- (test, config) = self._image_filename_re.match(image_name).groups() |
- if self._tests: |
- if test not in self._tests: |
- skipped_images.append(image_name) |
- continue |
- if self._configs: |
- if config not in self._configs: |
- skipped_images.append(image_name) |
- continue |
+ if self._image_filename_re: |
+ (test, config) = self._image_filename_re.match(image_name).groups() |
+ if self._tests: |
+ if test not in self._tests: |
+ skipped_images.append(image_name) |
+ continue |
+ if self._configs: |
+ if config not in self._configs: |
+ skipped_images.append(image_name) |
+ continue |
if not expected_results.get(image_name): |
expected_results[image_name] = {} |
expected_results[image_name]\ |
@@ -334,7 +347,6 @@ class JsonRebaseliner(object): |
if self._using_svn: |
self._Call(['svn', 'propset', '--quiet', 'svn:mime-type', |
'text/x-json', expectations_output_filepath]) |
- |
# main... |
parser = argparse.ArgumentParser( |
@@ -344,8 +356,10 @@ parser = argparse.ArgumentParser( |
parser.add_argument('--actuals-base-url', |
help=('base URL from which to read files containing JSON ' |
'summaries of actual GM results; defaults to ' |
- '%(default)s. To get a specific revision (useful for' |
- 'trybots) replace "svn" with "svn-history/r123".'), |
+ '%(default)s. To get a specific revision (useful for ' |
+ 'trybots) replace "svn" with "svn-history/r123". ' |
+ 'If SKIMAGE is True, defaults to ' + |
+ gm_json.SKIMAGE_ACTUALS_BASE_URL), |
default='http://skia-autogen.googlecode.com/svn/gm-actual') |
parser.add_argument('--actuals-filename', |
help=('filename (within builder-specific subdirectories ' |
@@ -370,7 +384,8 @@ parser.add_argument('--configs', metavar='CONFIG', nargs='+', |
help=('which configurations to rebaseline, e.g. ' |
'"--configs 565 8888", as a filter over the full set ' |
'of results in ACTUALS_FILENAME; if unspecified, ' |
- 'rebaseline *all* configs that are available.')) |
+ 'rebaseline *all* configs that are available. ' |
+ 'Ignored if SKIMAGE is True.')) |
parser.add_argument('--expectations-filename', |
help=('filename (under EXPECTATIONS_ROOT) to read ' |
'current expectations from, and to write new ' |
@@ -386,7 +401,8 @@ parser.add_argument('--expectations-filename-output', |
parser.add_argument('--expectations-root', |
help=('root of expectations directory to update-- should ' |
'contain one or more builder subdirectories. ' |
- 'Defaults to %(default)s'), |
+ 'Defaults to %(default)s. If SKIMAGE is set, ' |
+ ' defaults to ' + gm_json.SKIMAGE_EXPECTATIONS_ROOT), |
default=os.path.join('expectations', 'gm')) |
parser.add_argument('--keep-going-on-failure', action='store_true', |
help=('instead of halting at the first error encountered, ' |
@@ -402,7 +418,7 @@ parser.add_argument('--tests', metavar='TEST', nargs='+', |
'"--tests aaclip bigmatrix", as a filter over the ' |
'full set of results in ACTUALS_FILENAME; if ' |
'unspecified, rebaseline *all* tests that are ' |
- 'available.')) |
+ 'available. Ignored if SKIMAGE is True.')) |
parser.add_argument('--unreviewed', action='store_true', |
help=('mark all expectations modified by this run as ' |
'"%s": False' % |
@@ -414,6 +430,11 @@ parser.add_argument('--ignore-failure', action='store_true', |
parser.add_argument('--from-trybot', action='store_true', |
help=('pull the actual-results.json file from the ' |
'corresponding trybot, rather than the main builder')) |
+parser.add_argument('--skimage', action='store_true', |
+ help=('Rebaseline skimage results instead of gm. Defaults ' |
+ 'to False. If True, TESTS and CONFIGS are ignored, ' |
+ 'and ACTUALS_BASE_URL and EXPECTATIONS_ROOT are set ' |
+ 'to alternate defaults, specific to skimage.')) |
args = parser.parse_args() |
exception_handler = ExceptionHandler( |
keep_going_on_failure=args.keep_going_on_failure) |
@@ -423,6 +444,12 @@ if args.builders: |
else: |
builders = sorted(TEST_BUILDERS) |
missing_json_is_fatal = False |
+if args.skimage: |
+ # Use a different default if --skimage is specified. |
+ if args.actuals_base_url == parser.get_default('actuals_base_url'): |
+ args.actuals_base_url = gm_json.SKIMAGE_ACTUALS_BASE_URL |
+ if args.expectations_root == parser.get_default('expectations_root'): |
+ args.expectations_root = gm_json.SKIMAGE_EXPECTATIONS_ROOT |
for builder in builders: |
if not builder in TEST_BUILDERS: |
raise Exception(('unrecognized builder "%s"; ' + |
@@ -444,7 +471,8 @@ for builder in builders: |
add_new=args.add_new, bugs=args.bugs, notes=args.notes, |
mark_unreviewed=args.unreviewed, |
mark_ignore_failure=args.ignore_failure, |
- from_trybot=args.from_trybot) |
+ from_trybot=args.from_trybot, |
+ skip_pattern_matching=args.skimage) |
try: |
rebaseliner.RebaselineSubdir(builder=builder) |
except: |