Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: gm/rebaseline_server/compare_to_expectations.py

Issue 310093003: rebaseline_server: download actual-results.json files from GCS instead of SVN (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: combine import_gm and import_tools into fix_pythonpath Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import fix_pythonpath # must do this first
24 # TODO(epoger): Once we move the create_filepath_url() function out of 24 from pyutils import url_utils
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
29 # that directory. That script allows us to parse the actual-results.json file
30 # written out by the GM tool.
31 # 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.
33 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
34 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY)
35 TRUNK_DIRECTORY = os.path.dirname(GM_DIRECTORY)
36 if GM_DIRECTORY not in sys.path:
37 sys.path.append(GM_DIRECTORY)
38 import download_actuals
39 import gm_json 25 import gm_json
40 import imagediffdb 26 import imagediffdb
41 import imagepair 27 import imagepair
42 import imagepairset 28 import imagepairset
43 import results 29 import results
44 30
45 EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [ 31 EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [
46 results.KEY__EXPECTATIONS__BUGS, 32 results.KEY__EXPECTATIONS__BUGS,
47 results.KEY__EXPECTATIONS__IGNOREFAILURE, 33 results.KEY__EXPECTATIONS__IGNOREFAILURE,
48 results.KEY__EXPECTATIONS__REVIEWED, 34 results.KEY__EXPECTATIONS__REVIEWED,
49 ] 35 ]
36 TRUNK_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
50 DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm') 37 DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm')
51 DEFAULT_IGNORE_FAILURES_FILE = 'ignored-tests.txt' 38 DEFAULT_IGNORE_FAILURES_FILE = 'ignored-tests.txt'
52 39
53 IMAGEPAIR_SET_DESCRIPTIONS = ('expected image', 'actual image') 40 IMAGEPAIR_SET_DESCRIPTIONS = ('expected image', 'actual image')
54 41
55 42
56 class ExpectationComparisons(results.BaseComparisons): 43 class ExpectationComparisons(results.BaseComparisons):
57 """Loads actual and expected GM results into an ImagePairSet. 44 """Loads actual and expected GM results into an ImagePairSet.
58 45
59 Loads actual and expected results from all builders, except for those skipped 46 Loads actual and expected results from all builders, except for those skipped
(...skipping 21 matching lines...) Expand all
81 of generated_images_root 68 of generated_images_root
82 builder_regex_list: List of regular expressions specifying which builders 69 builder_regex_list: List of regular expressions specifying which builders
83 we will process. If None, process all builders. 70 we will process. If None, process all builders.
84 """ 71 """
85 time_start = int(time.time()) 72 time_start = int(time.time())
86 if builder_regex_list != None: 73 if builder_regex_list != None:
87 self.set_match_builders_pattern_list(builder_regex_list) 74 self.set_match_builders_pattern_list(builder_regex_list)
88 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) 75 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root)
89 self._diff_base_url = ( 76 self._diff_base_url = (
90 diff_base_url or 77 diff_base_url or
91 download_actuals.create_filepath_url(generated_images_root)) 78 url_utils.create_filepath_url(generated_images_root))
92 self._actuals_root = actuals_root 79 self._actuals_root = actuals_root
93 self._expected_root = expected_root 80 self._expected_root = expected_root
94 self._ignore_failures_on_these_tests = [] 81 self._ignore_failures_on_these_tests = []
95 if ignore_failures_file: 82 if ignore_failures_file:
96 self._ignore_failures_on_these_tests = ( 83 self._ignore_failures_on_these_tests = (
97 ExpectationComparisons._read_noncomment_lines( 84 ExpectationComparisons._read_noncomment_lines(
98 os.path.join(expected_root, ignore_failures_file))) 85 os.path.join(expected_root, ignore_failures_file)))
99 self._load_actual_and_expected() 86 self._load_actual_and_expected()
100 self._timestamp = int(time.time()) 87 self._timestamp = int(time.time())
101 logging.info('Results complete; took %d seconds.' % 88 logging.info('Results complete; took %d seconds.' %
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 expected_root=args.expectations, 382 expected_root=args.expectations,
396 ignore_failures_file=args.ignore_failures_file, 383 ignore_failures_file=args.ignore_failures_file,
397 generated_images_root=args.workdir) 384 generated_images_root=args.workdir)
398 gm_json.WriteToFile( 385 gm_json.WriteToFile(
399 results_obj.get_packaged_results_of_type(results_type=args.results), 386 results_obj.get_packaged_results_of_type(results_type=args.results),
400 args.outfile) 387 args.outfile)
401 388
402 389
403 if __name__ == '__main__': 390 if __name__ == '__main__':
404 main() 391 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698