Index: tools/rebaseline.py |
diff --git a/tools/rebaseline.py b/tools/rebaseline.py |
index 275d84ebed1ff56a9e21ff022ffb9bcef1d7497b..c0f764ed16e6edcf750ef970074d4ae6a571c059 100755 |
--- a/tools/rebaseline.py |
+++ b/tools/rebaseline.py |
@@ -177,7 +177,7 @@ class JsonRebaseliner(object): |
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 15:05:09
please update the docstring above
scroggo
2013/10/10 19:32:36
Done.
|
self._expectations_root = expectations_root |
self._expectations_input_filename = expectations_input_filename |
self._expectations_output_filename = expectations_output_filename |
@@ -191,7 +191,12 @@ 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: |
+ self._image_filename_re = None |
+ 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 |
@@ -213,6 +218,12 @@ class JsonRebaseliner(object): |
except urllib2.HTTPError as e: |
raise _InternalException('unable to read URL %s: %s' % ( |
filepath, e)) |
+ elif filepath.startswith('gs:'): |
epoger
2013/10/10 15:05:09
As discussed live: I think it's better to download
scroggo
2013/10/10 19:32:36
Done.
|
+ try: |
+ return subprocess.check_output(['gsutil', 'cat', filepath]) |
+ except subprocess.CalledProcessError: |
+ raise _InternalException('unable to read Google Storage URL %s: %s' % ( |
+ filepath, e)) |
else: |
return open(filepath, 'r').read() |
@@ -293,15 +304,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]\ |
@@ -414,6 +426,9 @@ 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.')) |
args = parser.parse_args() |
exception_handler = ExceptionHandler( |
keep_going_on_failure=args.keep_going_on_failure) |
@@ -423,6 +438,10 @@ if args.builders: |
else: |
builders = sorted(TEST_BUILDERS) |
missing_json_is_fatal = False |
+if args.skimage: |
+ # Hardcode variables for skimage. |
+ args.actuals_base_url = 'gs://chromium-skia-gm/skimage/actuals' |
epoger
2013/10/10 15:05:09
I think it will be surprising that these args are
scroggo
2013/10/10 19:32:36
Done, for --tests and --configs.
|
+ args.expectations_root = os.path.join('expectations', 'skimage') |
for builder in builders: |
if not builder in TEST_BUILDERS: |
raise Exception(('unrecognized builder "%s"; ' + |
@@ -444,7 +463,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: |