OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
epoger
2014/04/10 03:49:29
In some ways, this CL is not the best solution to
| |
2 | 2 |
3 """ | 3 """ |
epoger
2014/04/10 03:49:29
An example command line using this new argument is
| |
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 |
(...skipping 26 matching lines...) Expand all Loading... | |
40 import imagediffdb | 40 import imagediffdb |
41 import imagepair | 41 import imagepair |
42 import imagepairset | 42 import imagepairset |
43 import results | 43 import results |
44 | 44 |
45 | 45 |
46 class ConfigComparisons(results.BaseComparisons): | 46 class ConfigComparisons(results.BaseComparisons): |
47 """Loads results from two different configurations into an ImagePairSet. | 47 """Loads results from two different configurations into an ImagePairSet. |
48 | 48 |
49 Loads actual and expected results from all builders, except for those skipped | 49 Loads actual and expected results from all builders, except for those skipped |
50 by BaseComparisons._ignore_builder(). | 50 by _ignore_builder(). |
51 """ | 51 """ |
52 | 52 |
53 def __init__(self, configs, actuals_root=results.DEFAULT_ACTUALS_DIR, | 53 def __init__(self, configs, actuals_root=results.DEFAULT_ACTUALS_DIR, |
54 generated_images_root=results.DEFAULT_GENERATED_IMAGES_ROOT, | 54 generated_images_root=results.DEFAULT_GENERATED_IMAGES_ROOT, |
55 diff_base_url=None): | 55 diff_base_url=None, builder_regex_list=None): |
56 """ | 56 """ |
57 Args: | 57 Args: |
58 configs: (string, string) tuple; pair of configs to compare | 58 configs: (string, string) tuple; pair of configs to compare |
59 actuals_root: root directory containing all actual-results.json files | 59 actuals_root: root directory containing all actual-results.json files |
60 generated_images_root: directory within which to create all pixel diffs; | 60 generated_images_root: directory within which to create all pixel diffs; |
61 if this directory does not yet exist, it will be created | 61 if this directory does not yet exist, it will be created |
62 diff_base_url: base URL within which the client should look for diff | 62 diff_base_url: base URL within which the client should look for diff |
63 images; if not specified, defaults to a "file:///" URL representation | 63 images; if not specified, defaults to a "file:///" URL representation |
64 of generated_images_root | 64 of generated_images_root |
65 builder_regex_list: List of regular expressions specifying which builders | |
66 we will process. If None, process all builders. | |
65 """ | 67 """ |
66 time_start = int(time.time()) | 68 time_start = int(time.time()) |
69 if builder_regex_list != None: | |
70 self.set_match_builders_pattern_list(builder_regex_list) | |
67 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) | 71 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) |
68 self._diff_base_url = ( | 72 self._diff_base_url = ( |
69 diff_base_url or | 73 diff_base_url or |
70 download_actuals.create_filepath_url(generated_images_root)) | 74 download_actuals.create_filepath_url(generated_images_root)) |
71 self._actuals_root = actuals_root | 75 self._actuals_root = actuals_root |
72 self._load_config_pairs(configs) | 76 self._load_config_pairs(configs) |
73 self._timestamp = int(time.time()) | 77 self._timestamp = int(time.time()) |
74 logging.info('Results complete; took %d seconds.' % | 78 logging.info('Results complete; took %d seconds.' % |
75 (self._timestamp - time_start)) | 79 (self._timestamp - time_start)) |
76 | 80 |
77 def _load_config_pairs(self, configs): | 81 def _load_config_pairs(self, configs): |
78 """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 |
79 files within self._actuals_root), compares them across two configs, | 83 files within self._actuals_root), compares them across two configs, |
80 and stores the summary in self._results. | 84 and stores the summary in self._results. |
81 | 85 |
82 Args: | 86 Args: |
83 configs: tuple of strings; pair of configs to compare | 87 configs: tuple of strings; pair of configs to compare |
84 """ | 88 """ |
85 logging.info('Reading actual-results JSON files from %s...' % | 89 logging.info('Reading actual-results JSON files from %s...' % |
86 self._actuals_root) | 90 self._actuals_root) |
87 actual_builder_dicts = ConfigComparisons._read_dicts_from_root( | 91 actual_builder_dicts = self._read_dicts_from_root(self._actuals_root) |
88 self._actuals_root) | |
89 configA, configB = configs | 92 configA, configB = configs |
90 logging.info('Comparing configs %s and %s...' % (configA, configB)) | 93 logging.info('Comparing configs %s and %s...' % (configA, configB)) |
91 | 94 |
92 all_image_pairs = imagepairset.ImagePairSet( | 95 all_image_pairs = imagepairset.ImagePairSet( |
93 descriptions=configs, | 96 descriptions=configs, |
94 diff_base_url=self._diff_base_url) | 97 diff_base_url=self._diff_base_url) |
95 failing_image_pairs = imagepairset.ImagePairSet( | 98 failing_image_pairs = imagepairset.ImagePairSet( |
96 descriptions=configs, | 99 descriptions=configs, |
97 diff_base_url=self._diff_base_url) | 100 diff_base_url=self._diff_base_url) |
98 | 101 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 results_obj = ConfigComparisons(configs=args.config, | 213 results_obj = ConfigComparisons(configs=args.config, |
211 actuals_root=args.actuals, | 214 actuals_root=args.actuals, |
212 generated_images_root=args.workdir) | 215 generated_images_root=args.workdir) |
213 gm_json.WriteToFile( | 216 gm_json.WriteToFile( |
214 results_obj.get_packaged_results_of_type(results_type=args.results), | 217 results_obj.get_packaged_results_of_type(results_type=args.results), |
215 args.outfile) | 218 args.outfile) |
216 | 219 |
217 | 220 |
218 if __name__ == '__main__': | 221 if __name__ == '__main__': |
219 main() | 222 main() |
OLD | NEW |