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