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