aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-11 19:20:30 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-11 19:20:30 +0000
commit66ba9f978fa6d058d0d62057e13b63d9c03230c9 (patch)
treee80858c9f52ba24cde7e6a610c290e353998d56e /tools
parente2b9037c4031b7f7c7c8f4689039f4375b9d6e0a (diff)
rebaseline.py: skip any platforms we don't have actual results for, with warning message
R=borenet@google.com Review URL: https://codereview.chromium.org/19052007 git-svn-id: http://skia.googlecode.com/svn/trunk@10022 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rwxr-xr-xtools/rebaseline.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/rebaseline.py b/tools/rebaseline.py
index 5b8d12c860..1abc1dc91c 100755
--- a/tools/rebaseline.py
+++ b/tools/rebaseline.py
@@ -71,7 +71,7 @@ SUBDIR_MAPPING = {
}
-class CommandFailedException(Exception):
+class _InternalException(Exception):
pass
# Object that rebaselines a JSON expectations file (not individual image files).
@@ -106,9 +106,15 @@ class JsonRebaseliner(object):
# Returns the full contents of filepath, as a single string.
# If filepath looks like a URL, try to read it that way instead of as
# a path on local storage.
+ #
+ # Raises _InternalException if there is a problem.
def _GetFileContents(self, filepath):
if filepath.startswith('http:') or filepath.startswith('https:'):
- return urllib2.urlopen(filepath).read()
+ try:
+ return urllib2.urlopen(filepath).read()
+ except urllib2.HTTPError as e:
+ raise _InternalException('unable to read URL %s: %s' % (
+ filepath, e))
else:
return open(filepath, 'r').read()
@@ -121,8 +127,10 @@ class JsonRebaseliner(object):
# u'shadertext3_8888.png': [u'bitmap-64bitMD5', 3713708307125704716]
# }
#
- # If the JSON actual result summary file cannot be loaded, raise an
- # exception.
+ # If the JSON actual result summary file cannot be loaded, logs a warning
+ # message and returns None.
+ # If the JSON actual result summary file can be loaded, but we have
+ # trouble parsing it, raises an Exception.
#
# params:
# json_url: URL pointing to a JSON actual result summary file
@@ -131,7 +139,13 @@ class JsonRebaseliner(object):
# gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON] ;
# if None, then include ALL sections.
def _GetActualResults(self, json_url, sections=None):
- json_contents = self._GetFileContents(json_url)
+ try:
+ json_contents = self._GetFileContents(json_url)
+ except _InternalException:
+ print >> sys.stderr, (
+ 'could not read json_url %s ; skipping this platform.' %
+ json_url)
+ return None
json_dict = gm_json.LoadFromString(json_contents)
results_to_return = {}
actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS]