Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: tools/rebaseline.py

Issue 19052007: rebaseline.py: skip any platforms we don't have actual results for, with warning message (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: warning_instead Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/rebaseline.py
===================================================================
--- tools/rebaseline.py (revision 10016)
+++ tools/rebaseline.py (working copy)
@@ -71,7 +71,7 @@
}
-class CommandFailedException(Exception):
+class _InternalException(Exception):
pass
# Object that rebaselines a JSON expectations file (not individual image files).
@@ -106,9 +106,15 @@
# 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 @@
# 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 @@
# 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]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698