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