| 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 GM results for two configs, across all builders. | 9 Compare GM results for two configs, across all builders. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 # System-level imports | 12 # System-level imports |
| 13 import argparse | 13 import argparse |
| 14 import fnmatch | 14 import fnmatch |
| 15 import json | 15 import json |
| 16 import logging | 16 import logging |
| 17 import os |
| 17 import re | 18 import re |
| 19 import sys |
| 18 import time | 20 import time |
| 19 | 21 |
| 20 # Imports from within Skia | 22 # Imports from within Skia |
| 21 import fix_pythonpath # must do this first | 23 # |
| 22 from pyutils import url_utils | 24 # TODO(epoger): Once we move the create_filepath_url() function out of |
| 25 # download_actuals into a shared utility module, we won't need to import |
| 26 # download_actuals anymore. |
| 27 # |
| 28 # We need to add the 'gm' directory, so that we can import gm_json.py within |
| 29 # that directory. That script allows us to parse the actual-results.json file |
| 30 # written out by the GM tool. |
| 31 # Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end* |
| 32 # so any dirs that are already in the PYTHONPATH will be preferred. |
| 33 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) |
| 34 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY) |
| 35 TRUNK_DIRECTORY = os.path.dirname(GM_DIRECTORY) |
| 36 if GM_DIRECTORY not in sys.path: |
| 37 sys.path.append(GM_DIRECTORY) |
| 38 import download_actuals |
| 23 import gm_json | 39 import gm_json |
| 24 import imagediffdb | 40 import imagediffdb |
| 25 import imagepair | 41 import imagepair |
| 26 import imagepairset | 42 import imagepairset |
| 27 import results | 43 import results |
| 28 | 44 |
| 29 | 45 |
| 30 class ConfigComparisons(results.BaseComparisons): | 46 class ConfigComparisons(results.BaseComparisons): |
| 31 """Loads results from two different configurations into an ImagePairSet. | 47 """Loads results from two different configurations into an ImagePairSet. |
| 32 | 48 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 48 of generated_images_root | 64 of generated_images_root |
| 49 builder_regex_list: List of regular expressions specifying which builders | 65 builder_regex_list: List of regular expressions specifying which builders |
| 50 we will process. If None, process all builders. | 66 we will process. If None, process all builders. |
| 51 """ | 67 """ |
| 52 time_start = int(time.time()) | 68 time_start = int(time.time()) |
| 53 if builder_regex_list != None: | 69 if builder_regex_list != None: |
| 54 self.set_match_builders_pattern_list(builder_regex_list) | 70 self.set_match_builders_pattern_list(builder_regex_list) |
| 55 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) | 71 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) |
| 56 self._diff_base_url = ( | 72 self._diff_base_url = ( |
| 57 diff_base_url or | 73 diff_base_url or |
| 58 url_utils.create_filepath_url(generated_images_root)) | 74 download_actuals.create_filepath_url(generated_images_root)) |
| 59 self._actuals_root = actuals_root | 75 self._actuals_root = actuals_root |
| 60 self._load_config_pairs(configs) | 76 self._load_config_pairs(configs) |
| 61 self._timestamp = int(time.time()) | 77 self._timestamp = int(time.time()) |
| 62 logging.info('Results complete; took %d seconds.' % | 78 logging.info('Results complete; took %d seconds.' % |
| 63 (self._timestamp - time_start)) | 79 (self._timestamp - time_start)) |
| 64 | 80 |
| 65 def _load_config_pairs(self, configs): | 81 def _load_config_pairs(self, configs): |
| 66 """Loads the results of all tests, across all builders (based on the | 82 """Loads the results of all tests, across all builders (based on the |
| 67 files within self._actuals_root), compares them across two configs, | 83 files within self._actuals_root), compares them across two configs, |
| 68 and stores the summary in self._results. | 84 and stores the summary in self._results. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 results_obj = ConfigComparisons(configs=args.config, | 214 results_obj = ConfigComparisons(configs=args.config, |
| 199 actuals_root=args.actuals, | 215 actuals_root=args.actuals, |
| 200 generated_images_root=args.workdir) | 216 generated_images_root=args.workdir) |
| 201 gm_json.WriteToFile( | 217 gm_json.WriteToFile( |
| 202 results_obj.get_packaged_results_of_type(results_type=args.results), | 218 results_obj.get_packaged_results_of_type(results_type=args.results), |
| 203 args.outfile) | 219 args.outfile) |
| 204 | 220 |
| 205 | 221 |
| 206 if __name__ == '__main__': | 222 if __name__ == '__main__': |
| 207 main() | 223 main() |
| OLD | NEW |