Chromium Code Reviews| 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 | |
| 15 import json | |
| 16 import logging | 14 import logging |
| 17 import re | |
| 18 import time | 15 import time |
| 19 | 16 |
| 17 # Must fix up PYTHONPATH before importing from within Skia | |
| 18 # pylint: disable=W0611 | |
| 19 import fix_pythonpath | |
| 20 # pylint: enable=W0611 | |
|
borenet
2014/07/11 12:59:11
Why not:
import fix_pythonpath # pylint: disable
epoger
2014/07/11 14:18:42
Good idea, fixed throughout. I wasn't sure that w
| |
| 21 | |
| 20 # Imports from within Skia | 22 # Imports from within Skia |
| 21 import fix_pythonpath # must do this first | 23 from py.utils import url_utils |
| 22 from pyutils import url_utils | |
| 23 import gm_json | 24 import gm_json |
| 24 import imagediffdb | 25 import imagediffdb |
| 25 import imagepair | 26 import imagepair |
| 26 import imagepairset | 27 import imagepairset |
| 27 import results | 28 import results |
| 28 | 29 |
| 29 | 30 |
| 30 class ConfigComparisons(results.BaseComparisons): | 31 class ConfigComparisons(results.BaseComparisons): |
| 31 """Loads results from two different configurations into an ImagePairSet. | 32 """Loads results from two different configurations into an ImagePairSet. |
| 32 | 33 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 (builder_num, num_builders, builder)) | 106 (builder_num, num_builders, builder)) |
| 106 actual_results_for_this_builder = ( | 107 actual_results_for_this_builder = ( |
| 107 actual_builder_dicts[builder][gm_json.JSONKEY_ACTUALRESULTS]) | 108 actual_builder_dicts[builder][gm_json.JSONKEY_ACTUALRESULTS]) |
| 108 for result_type in sorted(actual_results_for_this_builder.keys()): | 109 for result_type in sorted(actual_results_for_this_builder.keys()): |
| 109 results_of_this_type = actual_results_for_this_builder[result_type] | 110 results_of_this_type = actual_results_for_this_builder[result_type] |
| 110 if not results_of_this_type: | 111 if not results_of_this_type: |
| 111 continue | 112 continue |
| 112 | 113 |
| 113 tests_found = set() | 114 tests_found = set() |
| 114 for image_name in sorted(results_of_this_type.keys()): | 115 for image_name in sorted(results_of_this_type.keys()): |
| 115 (test, config) = results.IMAGE_FILENAME_RE.match(image_name).groups() | 116 (test, _) = results.IMAGE_FILENAME_RE.match(image_name).groups() |
| 116 tests_found.add(test) | 117 tests_found.add(test) |
| 117 | 118 |
| 118 for test in tests_found: | 119 for test in tests_found: |
| 119 # Get image_relative_url (or None) for each of configA, configB | 120 # Get image_relative_url (or None) for each of configA, configB |
| 120 image_name_A = results.IMAGE_FILENAME_FORMATTER % (test, configA) | 121 image_name_A = results.IMAGE_FILENAME_FORMATTER % (test, configA) |
| 121 configA_image_relative_url = ConfigComparisons._create_relative_url( | 122 configA_image_relative_url = ConfigComparisons._create_relative_url( |
| 122 hashtype_and_digest=results_of_this_type.get(image_name_A), | 123 hashtype_and_digest=results_of_this_type.get(image_name_A), |
| 123 test_name=test) | 124 test_name=test) |
| 124 image_name_B = results.IMAGE_FILENAME_FORMATTER % (test, configB) | 125 image_name_B = results.IMAGE_FILENAME_FORMATTER % (test, configB) |
| 125 configB_image_relative_url = ConfigComparisons._create_relative_url( | 126 configB_image_relative_url = ConfigComparisons._create_relative_url( |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 153 image_diff_db=self._image_diff_db, | 154 image_diff_db=self._image_diff_db, |
| 154 base_url=gm_json.GM_ACTUALS_ROOT_HTTP_URL, | 155 base_url=gm_json.GM_ACTUALS_ROOT_HTTP_URL, |
| 155 imageA_relative_url=configA_image_relative_url, | 156 imageA_relative_url=configA_image_relative_url, |
| 156 imageB_relative_url=configB_image_relative_url, | 157 imageB_relative_url=configB_image_relative_url, |
| 157 extra_columns=extra_columns_dict) | 158 extra_columns=extra_columns_dict) |
| 158 all_image_pairs.add_image_pair(image_pair) | 159 all_image_pairs.add_image_pair(image_pair) |
| 159 if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: | 160 if result_type != results.KEY__RESULT_TYPE__SUCCEEDED: |
| 160 failing_image_pairs.add_image_pair(image_pair) | 161 failing_image_pairs.add_image_pair(image_pair) |
| 161 except (KeyError, TypeError): | 162 except (KeyError, TypeError): |
| 162 logging.exception( | 163 logging.exception( |
| 163 'got exception while creating ImagePair for image_name ' | 164 'got exception while creating ImagePair for test ' |
| 164 '"%s", builder "%s"' % (image_name, builder)) | 165 '"%s", builder "%s"' % (test, builder)) |
| 165 | 166 |
| 167 # pylint: disable=W0201 | |
| 166 self._results = { | 168 self._results = { |
| 167 results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(), | 169 results.KEY__HEADER__RESULTS_ALL: all_image_pairs.as_dict(), |
| 168 results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(), | 170 results.KEY__HEADER__RESULTS_FAILURES: failing_image_pairs.as_dict(), |
| 169 } | 171 } |
| 170 | 172 |
| 171 | 173 |
| 172 def main(): | 174 def main(): |
| 173 logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', | 175 logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', |
| 174 datefmt='%m/%d/%Y %H:%M:%S', | 176 datefmt='%m/%d/%Y %H:%M:%S', |
| 175 level=logging.INFO) | 177 level=logging.INFO) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 198 results_obj = ConfigComparisons(configs=args.config, | 200 results_obj = ConfigComparisons(configs=args.config, |
| 199 actuals_root=args.actuals, | 201 actuals_root=args.actuals, |
| 200 generated_images_root=args.workdir) | 202 generated_images_root=args.workdir) |
| 201 gm_json.WriteToFile( | 203 gm_json.WriteToFile( |
| 202 results_obj.get_packaged_results_of_type(results_type=args.results), | 204 results_obj.get_packaged_results_of_type(results_type=args.results), |
| 203 args.outfile) | 205 args.outfile) |
| 204 | 206 |
| 205 | 207 |
| 206 if __name__ == '__main__': | 208 if __name__ == '__main__': |
| 207 main() | 209 main() |
| OLD | NEW |