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

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

Issue 25555003: More improvements to HTTP baseline viewer (for GM results) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: todos_n_tabs Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gm/rebaseline_server/static/loader.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9
10 ''' 10 '''
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 """Gathers the results of all tests, across all builders (based on the 117 """Gathers the results of all tests, across all builders (based on the
118 contents of actual_builder_dicts and expected_builder_dicts) 118 contents of actual_builder_dicts and expected_builder_dicts)
119 and returns it in a list in the same form needed for self.GetAll(). 119 and returns it in a list in the same form needed for self.GetAll().
120 120
121 This is a static method, because once we start refreshing results 121 This is a static method, because once we start refreshing results
122 asynchronously, we need to make sure we are not corrupting the object's 122 asynchronously, we need to make sure we are not corrupting the object's
123 member variables. 123 member variables.
124 """ 124 """
125 test_data = [] 125 test_data = []
126 category_dict = {} 126 category_dict = {}
127 Results._EnsureIncludedInCategoryDict(category_dict, 'resultType', [
128 gm_json.JSONKEY_ACTUALRESULTS_FAILED,
129 gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED,
130 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON,
131 gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED,
132 ])
133
127 for builder in sorted(actual_builder_dicts.keys()): 134 for builder in sorted(actual_builder_dicts.keys()):
128 actual_results_for_this_builder = ( 135 actual_results_for_this_builder = (
129 actual_builder_dicts[builder][gm_json.JSONKEY_ACTUALRESULTS]) 136 actual_builder_dicts[builder][gm_json.JSONKEY_ACTUALRESULTS])
130 for result_type in sorted(actual_results_for_this_builder.keys()): 137 for result_type in sorted(actual_results_for_this_builder.keys()):
131 results_of_this_type = actual_results_for_this_builder[result_type] 138 results_of_this_type = actual_results_for_this_builder[result_type]
132 if not results_of_this_type: 139 if not results_of_this_type:
133 continue 140 continue
134 for image_name in sorted(results_of_this_type.keys()): 141 for image_name in sorted(results_of_this_type.keys()):
135 actual_image = results_of_this_type[image_name] 142 actual_image = results_of_this_type[image_name]
136 try: 143 try:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 "builder": builder, 205 "builder": builder,
199 "test": test, 206 "test": test,
200 "config": config, 207 "config": config,
201 "resultType": updated_result_type, 208 "resultType": updated_result_type,
202 "actualHashType": actual_image[0], 209 "actualHashType": actual_image[0],
203 "actualHashDigest": str(actual_image[1]), 210 "actualHashDigest": str(actual_image[1]),
204 "expectedHashType": expected_image[0], 211 "expectedHashType": expected_image[0],
205 "expectedHashDigest": str(expected_image[1]), 212 "expectedHashDigest": str(expected_image[1]),
206 } 213 }
207 Results._AddToCategoryDict(category_dict, results_for_this_test) 214 Results._AddToCategoryDict(category_dict, results_for_this_test)
208 215 test_data.append(results_for_this_test)
209 # TODO(epoger): For now, don't include succeeded results in the raw
210 # data. There are so many of them that they make the client too slow.
211 if updated_result_type != gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED:
212 test_data.append(results_for_this_test)
213 return {"categories": category_dict, "testData": test_data} 216 return {"categories": category_dict, "testData": test_data}
214 217
215 @staticmethod 218 @staticmethod
216 def _AddToCategoryDict(category_dict, test_results): 219 def _AddToCategoryDict(category_dict, test_results):
217 """Add test_results to the category dictionary we are building 220 """Add test_results to the category dictionary we are building.
218 (see documentation of self.GetAll() for the format of this dictionary). 221 (See documentation of self.GetAll() for the format of this dictionary.)
219 222
220 params: 223 params:
221 category_dict: category dict-of-dicts to add to; modify this in-place 224 category_dict: category dict-of-dicts to add to; modify this in-place
222 test_results: test data with which to update category_list, in a dict: 225 test_results: test data with which to update category_list, in a dict:
223 { 226 {
224 "category_name": "category_value", 227 "category_name": "category_value",
225 "category_name": "category_value", 228 "category_name": "category_value",
226 ... 229 ...
227 } 230 }
228 """ 231 """
229 for category in CATEGORIES_TO_SUMMARIZE: 232 for category in CATEGORIES_TO_SUMMARIZE:
230 category_value = test_results.get(category) 233 category_value = test_results.get(category)
231 if not category_value: 234 if not category_value:
232 continue # test_results did not include this category, keep going 235 continue # test_results did not include this category, keep going
233 if not category_dict.get(category): 236 if not category_dict.get(category):
234 category_dict[category] = {} 237 category_dict[category] = {}
235 if not category_dict[category].get(category_value): 238 if not category_dict[category].get(category_value):
236 category_dict[category][category_value] = 0 239 category_dict[category][category_value] = 0
237 category_dict[category][category_value] += 1 240 category_dict[category][category_value] += 1
241
242 @staticmethod
243 def _EnsureIncludedInCategoryDict(category_dict,
244 category_name, category_values):
245 """Ensure that the category name/value pairs are included in category_dict,
246 even if there aren't any results with that name/value pair.
247 (See documentation of self.GetAll() for the format of this dictionary.)
248
249 params:
250 category_dict: category dict-of-dicts to modify
251 category_name: category name, as a string
252 category_values: list of values we want to make sure are represented
253 for this category
254 """
255 if not category_dict.get(category_name):
256 category_dict[category_name] = {}
257 for category_value in category_values:
258 if not category_dict[category_name].get(category_value):
259 category_dict[category_name][category_value] = 0
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/static/loader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698