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

Side by Side Diff: gm/rebaseline_server/results.py

Issue 216103004: teach rebaseline_server how to compare results of multiple render_pictures runs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ravi comments Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2013 Google Inc. 4 Copyright 2013 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 8
9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
10 """ 10 """
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 hashtype_and_digest: (hash_type, hash_digest) tuple, or None if we 190 hashtype_and_digest: (hash_type, hash_digest) tuple, or None if we
191 don't have a record of this image 191 don't have a record of this image
192 test_name: string; name of the GM test that created this image 192 test_name: string; name of the GM test that created this image
193 """ 193 """
194 if not hashtype_and_digest: 194 if not hashtype_and_digest:
195 return None 195 return None
196 return gm_json.CreateGmRelativeUrl( 196 return gm_json.CreateGmRelativeUrl(
197 test_name=test_name, 197 test_name=test_name,
198 hash_type=hashtype_and_digest[0], 198 hash_type=hashtype_and_digest[0],
199 hash_digest=hashtype_and_digest[1]) 199 hash_digest=hashtype_and_digest[1])
200
201 @staticmethod
202 def combine_subdicts(input_dict):
203 """ Flatten out a dictionary structure by one level.
204
205 Input:
206 {
207 "failed" : {
208 "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
209 },
210 "no-comparison" : {
211 "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
212 }
213 }
214
215 Output:
216 {
217 "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
218 "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
219 }
220
221 If this would result in any repeated keys, it will raise an Exception.
222 """
223 output_dict = {}
224 for key, subdict in input_dict.iteritems():
225 for subdict_key, subdict_value in subdict.iteritems():
226 if subdict_key in output_dict:
227 raise Exception('duplicate key %s in combine_subdicts' % subdict_key)
228 output_dict[subdict_key] = subdict_value
229 return output_dict
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698