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 """ |
11 | 11 |
12 # System-level imports | 12 # System-level imports |
13 import logging | 13 import logging |
14 import os | 14 import os |
15 import re | |
16 import time | 15 import time |
17 | 16 |
17 # Must fix up PYTHONPATH before importing from within Skia | |
18 # pylint: disable=W0611 | |
19 import fix_pythonpath | |
20 # pylint: enable=W0611 | |
borenet
2014/07/11 12:59:11
Same comment.
| |
21 | |
18 # Imports from within Skia | 22 # Imports from within Skia |
19 import fix_pythonpath # must do this first | 23 from py.utils import url_utils |
20 from pyutils import url_utils | |
21 import gm_json | 24 import gm_json |
22 import imagediffdb | 25 import imagediffdb |
23 import imagepair | 26 import imagepair |
24 import imagepairset | 27 import imagepairset |
25 import results | 28 import results |
26 | 29 |
27 # URL under which all render_pictures images can be found in Google Storage. | 30 # URL under which all render_pictures images can be found in Google Storage. |
31 # | |
32 # pylint: disable=C0301 | |
28 # TODO(epoger): Move this default value into | 33 # TODO(epoger): Move this default value into |
29 # https://skia.googlesource.com/buildbot/+/master/site_config/global_variables.j son | 34 # https://skia.googlesource.com/buildbot/+/master/site_config/global_variables.j son |
30 DEFAULT_IMAGE_BASE_URL = 'http://chromium-skia-gm.commondatastorage.googleapis.c om/render_pictures/images' | 35 # pylint: enable=C0301 |
36 DEFAULT_IMAGE_BASE_URL = ( | |
37 'http://chromium-skia-gm.commondatastorage.googleapis.com/' | |
38 'render_pictures/images') | |
31 | 39 |
32 | 40 |
33 class RenderedPicturesComparisons(results.BaseComparisons): | 41 class RenderedPicturesComparisons(results.BaseComparisons): |
34 """Loads results from two different render_pictures runs into an ImagePairSet. | 42 """Loads results from two different render_pictures runs into an ImagePairSet. |
35 """ | 43 """ |
36 | 44 |
37 def __init__(self, subdirs, actuals_root, | 45 def __init__(self, subdirs, actuals_root, |
38 generated_images_root=results.DEFAULT_GENERATED_IMAGES_ROOT, | 46 generated_images_root=results.DEFAULT_GENERATED_IMAGES_ROOT, |
39 image_base_url=DEFAULT_IMAGE_BASE_URL, | 47 image_base_url=DEFAULT_IMAGE_BASE_URL, |
40 diff_base_url=None): | 48 diff_base_url=None): |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 # TODO(epoger): Report an error if we find a different number of tiles | 146 # TODO(epoger): Report an error if we find a different number of tiles |
139 # for A and B? | 147 # for A and B? |
140 num_tiles = len(tiled_images_A) | 148 num_tiles = len(tiled_images_A) |
141 for tile_num in range(num_tiles): | 149 for tile_num in range(num_tiles): |
142 imagepairs_for_this_skp.append(self._create_image_pair( | 150 imagepairs_for_this_skp.append(self._create_image_pair( |
143 test=skp_name, | 151 test=skp_name, |
144 config='%s-%d' % (gm_json.JSONKEY_SOURCE_TILEDIMAGES, tile_num), | 152 config='%s-%d' % (gm_json.JSONKEY_SOURCE_TILEDIMAGES, tile_num), |
145 image_dict_A=tiled_images_A[tile_num], | 153 image_dict_A=tiled_images_A[tile_num], |
146 image_dict_B=tiled_images_B[tile_num])) | 154 image_dict_B=tiled_images_B[tile_num])) |
147 | 155 |
148 for imagepair in imagepairs_for_this_skp: | 156 for one_imagepair in imagepairs_for_this_skp: |
149 if imagepair: | 157 if one_imagepair: |
150 all_image_pairs.add_image_pair(imagepair) | 158 all_image_pairs.add_image_pair(one_imagepair) |
151 result_type = imagepair.extra_columns_dict\ | 159 result_type = one_imagepair.extra_columns_dict\ |
152 [results.KEY__EXTRACOLUMNS__RESULT_TYPE] | 160 [results.KEY__EXTRACOLUMNS__RESULT_TYPE] |
153 if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: | 161 if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: |
154 failing_image_pairs.add_image_pair(imagepair) | 162 failing_image_pairs.add_image_pair(one_imagepair) |
155 | 163 |
164 # pylint: disable=W0201 | |
156 self._results = { | 165 self._results = { |
157 results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(), | 166 results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(), |
158 results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(), | 167 results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(), |
159 } | 168 } |
160 | 169 |
161 def _validate_dict_version(self, result_dict): | 170 def _validate_dict_version(self, result_dict): |
162 """Raises Exception if the dict is not the type/version we know how to read. | 171 """Raises Exception if the dict is not the type/version we know how to read. |
163 | 172 |
164 Args: | 173 Args: |
165 result_dict: dictionary holding output of render_pictures | 174 result_dict: dictionary holding output of render_pictures |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 extra_columns=extra_columns_dict) | 243 extra_columns=extra_columns_dict) |
235 except (KeyError, TypeError): | 244 except (KeyError, TypeError): |
236 logging.exception( | 245 logging.exception( |
237 'got exception while creating ImagePair for' | 246 'got exception while creating ImagePair for' |
238 ' test="%s", config="%s", urlPair=("%s","%s")' % ( | 247 ' test="%s", config="%s", urlPair=("%s","%s")' % ( |
239 test, config, imageA_relative_url, imageB_relative_url)) | 248 test, config, imageA_relative_url, imageB_relative_url)) |
240 return None | 249 return None |
241 | 250 |
242 | 251 |
243 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh | 252 # TODO(epoger): Add main() so this can be called by vm_run_skia_try.sh |
OLD | NEW |