| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """ | 3 """ |
| 4 Copyright 2013 Google Inc. | 4 Copyright 2013 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 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. | 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. |
| 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 EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [ | 41 EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [ |
| 46 results.KEY__EXPECTATIONS__BUGS, | 42 results.KEY__EXPECTATIONS__BUGS, |
| 47 results.KEY__EXPECTATIONS__IGNOREFAILURE, | 43 results.KEY__EXPECTATIONS__IGNOREFAILURE, |
| 48 results.KEY__EXPECTATIONS__REVIEWED, | 44 results.KEY__EXPECTATIONS__REVIEWED, |
| 49 ] | 45 ] |
| 50 DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm') | 46 DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm') |
| 51 DEFAULT_IGNORE_FAILURES_FILE = 'ignored-tests.txt' | 47 DEFAULT_IGNORE_FAILURES_FILE = 'ignored-tests.txt' |
| 52 | 48 |
| 53 IMAGEPAIR_SET_DESCRIPTIONS = ('expected image', 'actual image') | 49 IMAGEPAIR_SET_DESCRIPTIONS = ('expected image', 'actual image') |
| (...skipping 27 matching lines...) Expand all Loading... |
| 81 of generated_images_root | 77 of generated_images_root |
| 82 builder_regex_list: List of regular expressions specifying which builders | 78 builder_regex_list: List of regular expressions specifying which builders |
| 83 we will process. If None, process all builders. | 79 we will process. If None, process all builders. |
| 84 """ | 80 """ |
| 85 time_start = int(time.time()) | 81 time_start = int(time.time()) |
| 86 if builder_regex_list != None: | 82 if builder_regex_list != None: |
| 87 self.set_match_builders_pattern_list(builder_regex_list) | 83 self.set_match_builders_pattern_list(builder_regex_list) |
| 88 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) | 84 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) |
| 89 self._diff_base_url = ( | 85 self._diff_base_url = ( |
| 90 diff_base_url or | 86 diff_base_url or |
| 91 download_actuals.create_filepath_url(generated_images_root)) | 87 url_utils.create_filepath_url(generated_images_root)) |
| 92 self._actuals_root = actuals_root | 88 self._actuals_root = actuals_root |
| 93 self._expected_root = expected_root | 89 self._expected_root = expected_root |
| 94 self._ignore_failures_on_these_tests = [] | 90 self._ignore_failures_on_these_tests = [] |
| 95 if ignore_failures_file: | 91 if ignore_failures_file: |
| 96 self._ignore_failures_on_these_tests = ( | 92 self._ignore_failures_on_these_tests = ( |
| 97 ExpectationComparisons._read_noncomment_lines( | 93 ExpectationComparisons._read_noncomment_lines( |
| 98 os.path.join(expected_root, ignore_failures_file))) | 94 os.path.join(expected_root, ignore_failures_file))) |
| 99 self._load_actual_and_expected() | 95 self._load_actual_and_expected() |
| 100 self._timestamp = int(time.time()) | 96 self._timestamp = int(time.time()) |
| 101 logging.info('Results complete; took %d seconds.' % | 97 logging.info('Results complete; took %d seconds.' % |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 expected_root=args.expectations, | 391 expected_root=args.expectations, |
| 396 ignore_failures_file=args.ignore_failures_file, | 392 ignore_failures_file=args.ignore_failures_file, |
| 397 generated_images_root=args.workdir) | 393 generated_images_root=args.workdir) |
| 398 gm_json.WriteToFile( | 394 gm_json.WriteToFile( |
| 399 results_obj.get_packaged_results_of_type(results_type=args.results), | 395 results_obj.get_packaged_results_of_type(results_type=args.results), |
| 400 args.outfile) | 396 args.outfile) |
| 401 | 397 |
| 402 | 398 |
| 403 if __name__ == '__main__': | 399 if __name__ == '__main__': |
| 404 main() | 400 main() |
| OLD | NEW |