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 os |
18 import re | 18 import re |
19 import sys | 19 import sys |
20 import time | 20 import time |
21 | 21 |
22 # Imports from within Skia | 22 # Imports from within Skia |
23 # | 23 # |
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 | 24 # 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 | 25 # that directory. That script allows us to parse the actual-results.json file |
30 # written out by the GM tool. | 26 # written out by the GM tool. |
31 # Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end* | 27 # 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. | 28 # so any dirs that are already in the PYTHONPATH will be preferred. |
33 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) | 29 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) |
34 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY) | 30 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY) |
35 TRUNK_DIRECTORY = os.path.dirname(GM_DIRECTORY) | 31 TRUNK_DIRECTORY = os.path.dirname(GM_DIRECTORY) |
36 if GM_DIRECTORY not in sys.path: | 32 if GM_DIRECTORY not in sys.path: |
37 sys.path.append(GM_DIRECTORY) | 33 sys.path.append(GM_DIRECTORY) |
38 import download_actuals | |
39 import gm_json | 34 import gm_json |
40 import imagediffdb | 35 import imagediffdb |
41 import imagepair | 36 import imagepair |
42 import imagepairset | 37 import imagepairset |
43 import results | 38 import results |
| 39 import url_utils |
44 | 40 |
45 | 41 |
46 class ConfigComparisons(results.BaseComparisons): | 42 class ConfigComparisons(results.BaseComparisons): |
47 """Loads results from two different configurations into an ImagePairSet. | 43 """Loads results from two different configurations into an ImagePairSet. |
48 | 44 |
49 Loads actual and expected results from all builders, except for those skipped | 45 Loads actual and expected results from all builders, except for those skipped |
50 by _ignore_builder(). | 46 by _ignore_builder(). |
51 """ | 47 """ |
52 | 48 |
53 def __init__(self, configs, actuals_root=results.DEFAULT_ACTUALS_DIR, | 49 def __init__(self, configs, actuals_root=results.DEFAULT_ACTUALS_DIR, |
(...skipping 10 matching lines...) Expand all Loading... |
64 of generated_images_root | 60 of generated_images_root |
65 builder_regex_list: List of regular expressions specifying which builders | 61 builder_regex_list: List of regular expressions specifying which builders |
66 we will process. If None, process all builders. | 62 we will process. If None, process all builders. |
67 """ | 63 """ |
68 time_start = int(time.time()) | 64 time_start = int(time.time()) |
69 if builder_regex_list != None: | 65 if builder_regex_list != None: |
70 self.set_match_builders_pattern_list(builder_regex_list) | 66 self.set_match_builders_pattern_list(builder_regex_list) |
71 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) | 67 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) |
72 self._diff_base_url = ( | 68 self._diff_base_url = ( |
73 diff_base_url or | 69 diff_base_url or |
74 download_actuals.create_filepath_url(generated_images_root)) | 70 url_utils.create_filepath_url(generated_images_root)) |
75 self._actuals_root = actuals_root | 71 self._actuals_root = actuals_root |
76 self._load_config_pairs(configs) | 72 self._load_config_pairs(configs) |
77 self._timestamp = int(time.time()) | 73 self._timestamp = int(time.time()) |
78 logging.info('Results complete; took %d seconds.' % | 74 logging.info('Results complete; took %d seconds.' % |
79 (self._timestamp - time_start)) | 75 (self._timestamp - time_start)) |
80 | 76 |
81 def _load_config_pairs(self, configs): | 77 def _load_config_pairs(self, configs): |
82 """Loads the results of all tests, across all builders (based on the | 78 """Loads the results of all tests, across all builders (based on the |
83 files within self._actuals_root), compares them across two configs, | 79 files within self._actuals_root), compares them across two configs, |
84 and stores the summary in self._results. | 80 and stores the summary in self._results. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 results_obj = ConfigComparisons(configs=args.config, | 210 results_obj = ConfigComparisons(configs=args.config, |
215 actuals_root=args.actuals, | 211 actuals_root=args.actuals, |
216 generated_images_root=args.workdir) | 212 generated_images_root=args.workdir) |
217 gm_json.WriteToFile( | 213 gm_json.WriteToFile( |
218 results_obj.get_packaged_results_of_type(results_type=args.results), | 214 results_obj.get_packaged_results_of_type(results_type=args.results), |
219 args.outfile) | 215 args.outfile) |
220 | 216 |
221 | 217 |
222 if __name__ == '__main__': | 218 if __name__ == '__main__': |
223 main() | 219 main() |
OLD | NEW |