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 fnmatch | 13 import fnmatch |
14 import os | 14 import os |
15 import re | 15 import re |
| 16 import sys |
16 | 17 |
17 # Imports from within Skia | 18 # Imports from within Skia |
18 import fix_pythonpath # must do this first | 19 # |
| 20 # We need to add the 'gm' directory, so that we can import gm_json.py within |
| 21 # that directory. That script allows us to parse the actual-results.json file |
| 22 # written out by the GM tool. |
| 23 # Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end* |
| 24 # so any dirs that are already in the PYTHONPATH will be preferred. |
| 25 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) |
| 26 GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY) |
| 27 if GM_DIRECTORY not in sys.path: |
| 28 sys.path.append(GM_DIRECTORY) |
19 import gm_json | 29 import gm_json |
20 import imagepairset | 30 import imagepairset |
21 | 31 |
22 # Keys used to link an image to a particular GM test. | 32 # Keys used to link an image to a particular GM test. |
23 # NOTE: Keep these in sync with static/constants.js | 33 # NOTE: Keep these in sync with static/constants.js |
24 VALUE__HEADER__SCHEMA_VERSION = 3 | 34 VALUE__HEADER__SCHEMA_VERSION = 3 |
25 KEY__EXPECTATIONS__BUGS = gm_json.JSONKEY_EXPECTEDRESULTS_BUGS | 35 KEY__EXPECTATIONS__BUGS = gm_json.JSONKEY_EXPECTEDRESULTS_BUGS |
26 KEY__EXPECTATIONS__IGNOREFAILURE = gm_json.JSONKEY_EXPECTEDRESULTS_IGNOREFAILURE | 36 KEY__EXPECTATIONS__IGNOREFAILURE = gm_json.JSONKEY_EXPECTEDRESULTS_IGNOREFAILURE |
27 KEY__EXPECTATIONS__REVIEWED = gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED | 37 KEY__EXPECTATIONS__REVIEWED = gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED |
28 KEY__EXTRACOLUMNS__BUILDER = 'builder' | 38 KEY__EXTRACOLUMNS__BUILDER = 'builder' |
(...skipping 11 matching lines...) Expand all Loading... |
40 KEY__HEADER__TIME_UPDATED = 'timeUpdated' | 50 KEY__HEADER__TIME_UPDATED = 'timeUpdated' |
41 KEY__HEADER__TYPE = 'type' | 51 KEY__HEADER__TYPE = 'type' |
42 KEY__RESULT_TYPE__FAILED = gm_json.JSONKEY_ACTUALRESULTS_FAILED | 52 KEY__RESULT_TYPE__FAILED = gm_json.JSONKEY_ACTUALRESULTS_FAILED |
43 KEY__RESULT_TYPE__FAILUREIGNORED = gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED | 53 KEY__RESULT_TYPE__FAILUREIGNORED = gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED |
44 KEY__RESULT_TYPE__NOCOMPARISON = gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON | 54 KEY__RESULT_TYPE__NOCOMPARISON = gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON |
45 KEY__RESULT_TYPE__SUCCEEDED = gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED | 55 KEY__RESULT_TYPE__SUCCEEDED = gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED |
46 | 56 |
47 IMAGE_FILENAME_RE = re.compile(gm_json.IMAGE_FILENAME_PATTERN) | 57 IMAGE_FILENAME_RE = re.compile(gm_json.IMAGE_FILENAME_PATTERN) |
48 IMAGE_FILENAME_FORMATTER = '%s_%s.png' # pass in (testname, config) | 58 IMAGE_FILENAME_FORMATTER = '%s_%s.png' # pass in (testname, config) |
49 | 59 |
50 PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) | |
51 DEFAULT_ACTUALS_DIR = '.gm-actuals' | 60 DEFAULT_ACTUALS_DIR = '.gm-actuals' |
52 DEFAULT_GENERATED_IMAGES_ROOT = os.path.join( | 61 DEFAULT_GENERATED_IMAGES_ROOT = os.path.join( |
53 PARENT_DIRECTORY, '.generated-images') | 62 PARENT_DIRECTORY, '.generated-images') |
54 | 63 |
55 # Define the default set of builders we will process expectations/actuals for. | 64 # Define the default set of builders we will process expectations/actuals for. |
56 # This allows us to ignore builders for which we don't maintain expectations | 65 # This allows us to ignore builders for which we don't maintain expectations |
57 # (trybots, Valgrind, ASAN, TSAN), and avoid problems like | 66 # (trybots, Valgrind, ASAN, TSAN), and avoid problems like |
58 # https://code.google.com/p/skia/issues/detail?id=2036 ('rebaseline_server | 67 # https://code.google.com/p/skia/issues/detail?id=2036 ('rebaseline_server |
59 # produces error when trying to add baselines for ASAN/TSAN builders') | 68 # produces error when trying to add baselines for ASAN/TSAN builders') |
60 DEFAULT_MATCH_BUILDERS_PATTERN_LIST = ['.*'] | 69 DEFAULT_MATCH_BUILDERS_PATTERN_LIST = ['.*'] |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 311 |
303 @staticmethod | 312 @staticmethod |
304 def get_multilevel(input_dict, *keys): | 313 def get_multilevel(input_dict, *keys): |
305 """ Returns input_dict[key1][key2][...], or None if any key is not found. | 314 """ Returns input_dict[key1][key2][...], or None if any key is not found. |
306 """ | 315 """ |
307 for key in keys: | 316 for key in keys: |
308 if input_dict == None: | 317 if input_dict == None: |
309 return None | 318 return None |
310 input_dict = input_dict.get(key, None) | 319 input_dict = input_dict.get(key, None) |
311 return input_dict | 320 return input_dict |
OLD | NEW |