| 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 | 15 import re |
| 16 import sys |
| 16 import time | 17 import time |
| 17 | 18 |
| 18 # Imports from within Skia | 19 # Imports from within Skia |
| 19 import fix_pythonpath # must do this first | 20 # |
| 20 from pyutils import url_utils | 21 # TODO(epoger): Once we move the create_filepath_url() function out of |
| 22 # download_actuals into a shared utility module, we won't need to import |
| 23 # download_actuals anymore. |
| 24 # |
| 25 # We need to add the 'gm' directory, so that we can import gm_json.py within |
| 26 # that directory. That script allows us to parse the actual-results.json file |
| 27 # written out by the GM tool. |
| 28 # Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end* |
| 29 # so any dirs that are already in the PYTHONPATH will be preferred. |
| 30 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) |
| 31 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY) |
| 32 TRUNK_DIRECTORY = os.path.dirname(GM_DIRECTORY) |
| 33 if GM_DIRECTORY not in sys.path: |
| 34 sys.path.append(GM_DIRECTORY) |
| 35 import download_actuals |
| 21 import gm_json | 36 import gm_json |
| 22 import imagediffdb | 37 import imagediffdb |
| 23 import imagepair | 38 import imagepair |
| 24 import imagepairset | 39 import imagepairset |
| 25 import results | 40 import results |
| 26 | 41 |
| 27 # URL under which all render_pictures images can be found in Google Storage. | 42 # URL under which all render_pictures images can be found in Google Storage. |
| 28 # TODO(epoger): Move this default value into | 43 # TODO(epoger): Move this default value into |
| 29 # https://skia.googlesource.com/buildbot/+/master/site_config/global_variables.j
son | 44 # 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' | 45 DEFAULT_IMAGE_BASE_URL = 'http://chromium-skia-gm.commondatastorage.googleapis.c
om/render_pictures/images' |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 where to download the images from | 67 where to download the images from |
| 53 diff_base_url: base URL within which the client should look for diff | 68 diff_base_url: base URL within which the client should look for diff |
| 54 images; if not specified, defaults to a "file:///" URL representation | 69 images; if not specified, defaults to a "file:///" URL representation |
| 55 of generated_images_root | 70 of generated_images_root |
| 56 """ | 71 """ |
| 57 time_start = int(time.time()) | 72 time_start = int(time.time()) |
| 58 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) | 73 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) |
| 59 self._image_base_url = image_base_url | 74 self._image_base_url = image_base_url |
| 60 self._diff_base_url = ( | 75 self._diff_base_url = ( |
| 61 diff_base_url or | 76 diff_base_url or |
| 62 url_utils.create_filepath_url(generated_images_root)) | 77 download_actuals.create_filepath_url(generated_images_root)) |
| 63 self._load_result_pairs(actuals_root, subdirs) | 78 self._load_result_pairs(actuals_root, subdirs) |
| 64 self._timestamp = int(time.time()) | 79 self._timestamp = int(time.time()) |
| 65 logging.info('Results complete; took %d seconds.' % | 80 logging.info('Results complete; took %d seconds.' % |
| 66 (self._timestamp - time_start)) | 81 (self._timestamp - time_start)) |
| 67 | 82 |
| 68 def _load_result_pairs(self, actuals_root, subdirs): | 83 def _load_result_pairs(self, actuals_root, subdirs): |
| 69 """Loads all JSON files found within two subdirs in actuals_root, | 84 """Loads all JSON files found within two subdirs in actuals_root, |
| 70 compares across those two subdirs, and stores the summary in self._results. | 85 compares across those two subdirs, and stores the summary in self._results. |
| 71 | 86 |
| 72 Args: | 87 Args: |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 extra_columns=extra_columns_dict) | 249 extra_columns=extra_columns_dict) |
| 235 except (KeyError, TypeError): | 250 except (KeyError, TypeError): |
| 236 logging.exception( | 251 logging.exception( |
| 237 'got exception while creating ImagePair for' | 252 'got exception while creating ImagePair for' |
| 238 ' test="%s", config="%s", urlPair=("%s","%s")' % ( | 253 ' test="%s", config="%s", urlPair=("%s","%s")' % ( |
| 239 test, config, imageA_relative_url, imageB_relative_url)) | 254 test, config, imageA_relative_url, imageB_relative_url)) |
| 240 return None | 255 return None |
| 241 | 256 |
| 242 | 257 |
| 243 # 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 |