OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Schema of the JSON summary file written out by the GM tool. | 6 """Schema of the JSON summary file written out by the GM tool. |
7 | 7 |
8 This must be kept in sync with the kJsonKey_ constants in gm_expectations.cpp ! | 8 This must be kept in sync with the kJsonKey_ constants in gm_expectations.cpp ! |
9 """ | 9 """ |
10 | 10 |
11 __author__ = 'Elliot Poger' | 11 __author__ = 'Elliot Poger' |
12 | 12 |
13 | 13 |
14 # system-level imports | 14 # system-level imports |
15 import io | 15 import io |
16 import json | 16 import json |
17 import os | 17 import os |
18 import posixpath | 18 import posixpath |
19 import re | 19 import re |
20 | 20 |
21 | 21 |
22 # Key strings used in GM results JSON files (both expected-results.json and | 22 # Key strings used in GM results JSON files (both expected-results.json and |
23 # actual-results.json). | 23 # actual-results.json). |
24 # | 24 # |
25 # NOTE: These constants must be kept in sync with the kJsonKey_ constants in | 25 # NOTE: These constants must be kept in sync with the kJsonKey_ constants in |
26 # gm_expectations.cpp ! | 26 # gm_expectations.cpp and tools/PictureRenderer.cpp ! |
| 27 # Eric suggests: create gm/gm_expectations_constants.h containing ONLY variable |
| 28 # declarations so as to be readable by both gm/gm_expectations.cpp and Python. |
27 | 29 |
28 | 30 |
29 JSONKEY_ACTUALRESULTS = 'actual-results' | 31 JSONKEY_ACTUALRESULTS = 'actual-results' |
30 | 32 |
31 # Tests whose results failed to match expectations. | 33 # Tests whose results failed to match expectations. |
32 JSONKEY_ACTUALRESULTS_FAILED = 'failed' | 34 JSONKEY_ACTUALRESULTS_FAILED = 'failed' |
33 | 35 |
34 # Tests whose results failed to match expectations, but IGNOREFAILURE causes | 36 # Tests whose results failed to match expectations, but IGNOREFAILURE causes |
35 # us to take them less seriously. | 37 # us to take them less seriously. |
36 JSONKEY_ACTUALRESULTS_FAILUREIGNORED = 'failure-ignored' | 38 JSONKEY_ACTUALRESULTS_FAILUREIGNORED = 'failure-ignored' |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 70 |
69 # Optional: boolean indicating whether this expectation was reviewed/approved | 71 # Optional: boolean indicating whether this expectation was reviewed/approved |
70 # by a human being. | 72 # by a human being. |
71 # If True: a human looked at this image and approved it. | 73 # If True: a human looked at this image and approved it. |
72 # If False: this expectation was committed blind. (In such a case, please | 74 # If False: this expectation was committed blind. (In such a case, please |
73 # add notes indicating why!) | 75 # add notes indicating why!) |
74 # If absent: this expectation was committed by a tool that didn't enforce human | 76 # If absent: this expectation was committed by a tool that didn't enforce human |
75 # review of expectations. | 77 # review of expectations. |
76 JSONKEY_EXPECTEDRESULTS_REVIEWED = 'reviewed-by-human' | 78 JSONKEY_EXPECTEDRESULTS_REVIEWED = 'reviewed-by-human' |
77 | 79 |
78 | |
79 # Allowed hash types for test expectations. | 80 # Allowed hash types for test expectations. |
80 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' | 81 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' |
81 | 82 |
| 83 JSONKEY_HEADER = 'header' |
| 84 JSONKEY_HEADER_TYPE = 'type' |
| 85 JSONKEY_HEADER_REVISION = 'revision' |
| 86 JSONKEY_IMAGE_CHECKSUMALGORITHM = 'checksumAlgorithm' |
| 87 JSONKEY_IMAGE_CHECKSUMVALUE = 'checksumValue' |
| 88 JSONKEY_IMAGE_COMPARISONRESULT = 'comparisonResult' |
| 89 JSONKEY_IMAGE_FILEPATH = 'filepath' |
| 90 JSONKEY_SOURCE_TILEDIMAGES = 'tiled-images' |
| 91 JSONKEY_SOURCE_WHOLEIMAGE = 'whole-image' |
| 92 |
| 93 |
82 # Root directory where the buildbots store their actually-generated images... | 94 # Root directory where the buildbots store their actually-generated images... |
83 # as a publicly readable HTTP URL: | 95 # as a publicly readable HTTP URL: |
84 GM_ACTUALS_ROOT_HTTP_URL = ( | 96 GM_ACTUALS_ROOT_HTTP_URL = ( |
85 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') | 97 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') |
86 # as a GS URL that allows credential-protected write access: | 98 # as a GS URL that allows credential-protected write access: |
87 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' | 99 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' |
88 | 100 |
89 # Root directory where buildbots store skimage actual results json files. | 101 # Root directory where buildbots store skimage actual results json files. |
90 SKIMAGE_ACTUALS_BASE_URL = ( | 102 SKIMAGE_ACTUALS_BASE_URL = ( |
91 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals') | 103 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals') |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 181 |
170 | 182 |
171 def WriteToFile(json_dict, file_path): | 183 def WriteToFile(json_dict, file_path): |
172 """Writes the JSON summary in json_dict out to file_path. | 184 """Writes the JSON summary in json_dict out to file_path. |
173 | 185 |
174 The file is written Unix-style (each line ends with just LF, not CRLF); | 186 The file is written Unix-style (each line ends with just LF, not CRLF); |
175 see https://code.google.com/p/skia/issues/detail?id=1815 for reasons.""" | 187 see https://code.google.com/p/skia/issues/detail?id=1815 for reasons.""" |
176 with io.open(file_path, mode='w', newline='', encoding='utf-8') as outfile: | 188 with io.open(file_path, mode='w', newline='', encoding='utf-8') as outfile: |
177 outfile.write(unicode(json.dumps(json_dict, outfile, sort_keys=True, | 189 outfile.write(unicode(json.dumps(json_dict, outfile, sort_keys=True, |
178 indent=2))) | 190 indent=2))) |
OLD | NEW |