aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/rebaseline_server/results.py
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-04 16:40:25 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-04 16:40:25 +0000
commit3eb77e4d5a381fa55197f6bd03c599e709146069 (patch)
tree86e637b6feaa657e225a5b706508b7215c4168ce /gm/rebaseline_server/results.py
parenta13767579d25a7182d697e93d0df294eccc91507 (diff)
teach rebaseline_server how to compare results of multiple render_pictures runs
BUG=skia:2230,skia:1942 NOTRY=True R=rmistry@google.com Author: epoger@google.com Review URL: https://codereview.chromium.org/216103004 git-svn-id: http://skia.googlecode.com/svn/trunk@14062 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/rebaseline_server/results.py')
-rwxr-xr-xgm/rebaseline_server/results.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/gm/rebaseline_server/results.py b/gm/rebaseline_server/results.py
index 7cf57453ca..49e32519a7 100755
--- a/gm/rebaseline_server/results.py
+++ b/gm/rebaseline_server/results.py
@@ -197,3 +197,33 @@ class BaseComparisons(object):
test_name=test_name,
hash_type=hashtype_and_digest[0],
hash_digest=hashtype_and_digest[1])
+
+ @staticmethod
+ def combine_subdicts(input_dict):
+ """ Flatten out a dictionary structure by one level.
+
+ Input:
+ {
+ "failed" : {
+ "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
+ },
+ "no-comparison" : {
+ "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
+ }
+ }
+
+ Output:
+ {
+ "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
+ "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
+ }
+
+ If this would result in any repeated keys, it will raise an Exception.
+ """
+ output_dict = {}
+ for key, subdict in input_dict.iteritems():
+ for subdict_key, subdict_value in subdict.iteritems():
+ if subdict_key in output_dict:
+ raise Exception('duplicate key %s in combine_subdicts' % subdict_key)
+ output_dict[subdict_key] = subdict_value
+ return output_dict