OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2014 Google Inc. | 4 Copyright 2014 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 Compare results of two render_pictures runs. | 9 Compare results of two render_pictures runs. |
10 """ | 10 """ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 logging.info('Comparing subdirs %s and %s...' % (subdirA, subdirB)) | 101 logging.info('Comparing subdirs %s and %s...' % (subdirA, subdirB)) |
102 | 102 |
103 all_image_pairs = imagepairset.ImagePairSet( | 103 all_image_pairs = imagepairset.ImagePairSet( |
104 descriptions=subdirs, | 104 descriptions=subdirs, |
105 diff_base_url=self._diff_base_url) | 105 diff_base_url=self._diff_base_url) |
106 failing_image_pairs = imagepairset.ImagePairSet( | 106 failing_image_pairs = imagepairset.ImagePairSet( |
107 descriptions=subdirs, | 107 descriptions=subdirs, |
108 diff_base_url=self._diff_base_url) | 108 diff_base_url=self._diff_base_url) |
109 | 109 |
110 all_image_pairs.ensure_extra_column_values_in_summary( | 110 all_image_pairs.ensure_extra_column_values_in_summary( |
111 column_id=results.KEY__EXTRACOLUMN__RESULT_TYPE, values=[ | 111 column_id=results.KEY__EXTRACOLUMNS__RESULT_TYPE, values=[ |
112 results.KEY__RESULT_TYPE__FAILED, | 112 results.KEY__RESULT_TYPE__FAILED, |
113 results.KEY__RESULT_TYPE__NOCOMPARISON, | 113 results.KEY__RESULT_TYPE__NOCOMPARISON, |
114 results.KEY__RESULT_TYPE__SUCCEEDED, | 114 results.KEY__RESULT_TYPE__SUCCEEDED, |
115 ]) | 115 ]) |
116 failing_image_pairs.ensure_extra_column_values_in_summary( | 116 failing_image_pairs.ensure_extra_column_values_in_summary( |
117 column_id=results.KEY__EXTRACOLUMN__RESULT_TYPE, values=[ | 117 column_id=results.KEY__EXTRACOLUMNS__RESULT_TYPE, values=[ |
118 results.KEY__RESULT_TYPE__FAILED, | 118 results.KEY__RESULT_TYPE__FAILED, |
119 results.KEY__RESULT_TYPE__NOCOMPARISON, | 119 results.KEY__RESULT_TYPE__NOCOMPARISON, |
120 ]) | 120 ]) |
121 | 121 |
122 common_dict_paths = sorted(set(subdirA_dicts.keys() + subdirB_dicts.keys())) | 122 common_dict_paths = sorted(set(subdirA_dicts.keys() + subdirB_dicts.keys())) |
123 num_common_dict_paths = len(common_dict_paths) | 123 num_common_dict_paths = len(common_dict_paths) |
124 dict_num = 0 | 124 dict_num = 0 |
125 for dict_path in common_dict_paths: | 125 for dict_path in common_dict_paths: |
126 dict_num += 1 | 126 dict_num += 1 |
127 logging.info('Generating pixel diffs for dict #%d of %d, "%s"...' % | 127 logging.info('Generating pixel diffs for dict #%d of %d, "%s"...' % |
(...skipping 29 matching lines...) Expand all Loading... |
157 imagepairs_for_this_skp.append(self._create_image_pair( | 157 imagepairs_for_this_skp.append(self._create_image_pair( |
158 test=skp_name, | 158 test=skp_name, |
159 config='%s-%d' % (gm_json.JSONKEY_SOURCE_TILEDIMAGES, tile_num), | 159 config='%s-%d' % (gm_json.JSONKEY_SOURCE_TILEDIMAGES, tile_num), |
160 image_dict_A=tiled_images_A[tile_num], | 160 image_dict_A=tiled_images_A[tile_num], |
161 image_dict_B=tiled_images_B[tile_num])) | 161 image_dict_B=tiled_images_B[tile_num])) |
162 | 162 |
163 for imagepair in imagepairs_for_this_skp: | 163 for imagepair in imagepairs_for_this_skp: |
164 if imagepair: | 164 if imagepair: |
165 all_image_pairs.add_image_pair(imagepair) | 165 all_image_pairs.add_image_pair(imagepair) |
166 result_type = imagepair.extra_columns_dict\ | 166 result_type = imagepair.extra_columns_dict\ |
167 [results.KEY__EXTRACOLUMN__RESULT_TYPE] | 167 [results.KEY__EXTRACOLUMNS__RESULT_TYPE] |
168 if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: | 168 if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: |
169 failing_image_pairs.add_image_pair(imagepair) | 169 failing_image_pairs.add_image_pair(imagepair) |
170 | 170 |
171 self._results = { | 171 self._results = { |
172 results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(), | 172 results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(), |
173 results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(), | 173 results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(), |
174 } | 174 } |
175 | 175 |
176 def _validate_dict_version(self, result_dict): | 176 def _validate_dict_version(self, result_dict): |
177 """Raises Exception if the dict is not the type/version we know how to read. | 177 """Raises Exception if the dict is not the type/version we know how to read. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if not imageA_checksum: | 224 if not imageA_checksum: |
225 result_type = results.KEY__RESULT_TYPE__NOCOMPARISON | 225 result_type = results.KEY__RESULT_TYPE__NOCOMPARISON |
226 elif not imageB_checksum: | 226 elif not imageB_checksum: |
227 result_type = results.KEY__RESULT_TYPE__NOCOMPARISON | 227 result_type = results.KEY__RESULT_TYPE__NOCOMPARISON |
228 elif imageA_checksum == imageB_checksum: | 228 elif imageA_checksum == imageB_checksum: |
229 result_type = results.KEY__RESULT_TYPE__SUCCEEDED | 229 result_type = results.KEY__RESULT_TYPE__SUCCEEDED |
230 else: | 230 else: |
231 result_type = results.KEY__RESULT_TYPE__FAILED | 231 result_type = results.KEY__RESULT_TYPE__FAILED |
232 | 232 |
233 extra_columns_dict = { | 233 extra_columns_dict = { |
234 results.KEY__EXTRACOLUMN__CONFIG: config, | 234 results.KEY__EXTRACOLUMNS__CONFIG: config, |
235 results.KEY__EXTRACOLUMN__RESULT_TYPE: result_type, | 235 results.KEY__EXTRACOLUMNS__RESULT_TYPE: result_type, |
236 results.KEY__EXTRACOLUMN__TEST: test, | 236 results.KEY__EXTRACOLUMNS__TEST: test, |
237 # TODO(epoger): Right now, the client UI crashes if it receives | 237 # TODO(epoger): Right now, the client UI crashes if it receives |
238 # results that do not include this column. | 238 # results that do not include this column. |
239 # Until we fix that, keep the client happy. | 239 # Until we fix that, keep the client happy. |
240 results.KEY__EXTRACOLUMN__BUILDER: 'TODO', | 240 results.KEY__EXTRACOLUMNS__BUILDER: 'TODO', |
241 } | 241 } |
242 | 242 |
243 try: | 243 try: |
244 return imagepair.ImagePair( | 244 return imagepair.ImagePair( |
245 image_diff_db=self._image_diff_db, | 245 image_diff_db=self._image_diff_db, |
246 base_url=self._image_base_url, | 246 base_url=self._image_base_url, |
247 imageA_relative_url=imageA_relative_url, | 247 imageA_relative_url=imageA_relative_url, |
248 imageB_relative_url=imageB_relative_url, | 248 imageB_relative_url=imageB_relative_url, |
249 extra_columns=extra_columns_dict) | 249 extra_columns=extra_columns_dict) |
250 except (KeyError, TypeError): | 250 except (KeyError, TypeError): |
251 logging.exception( | 251 logging.exception( |
252 'got exception while creating ImagePair for' | 252 'got exception while creating ImagePair for' |
253 ' test="%s", config="%s", urlPair=("%s","%s")' % ( | 253 ' test="%s", config="%s", urlPair=("%s","%s")' % ( |
254 test, config, imageA_relative_url, imageB_relative_url)) | 254 test, config, imageA_relative_url, imageB_relative_url)) |
255 return None | 255 return None |
256 | 256 |
257 | 257 |
258 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh | 258 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh |
OLD | NEW |