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 ! |
borenet
2014/05/06 14:35:48
This is scary!
epoger
2014/05/06 15:13:53
Agreed.
The good news is that in another CL I am
borenet
2014/05/06 15:26:55
Off the top of my head - gm/gm_expectations_consta
| |
27 | 27 |
28 | 28 |
29 JSONKEY_ACTUALRESULTS = 'actual-results' | 29 JSONKEY_ACTUALRESULTS = 'actual-results' |
30 | 30 |
31 # Tests whose results failed to match expectations. | 31 # Tests whose results failed to match expectations. |
32 JSONKEY_ACTUALRESULTS_FAILED = 'failed' | 32 JSONKEY_ACTUALRESULTS_FAILED = 'failed' |
33 | 33 |
34 # Tests whose results failed to match expectations, but IGNOREFAILURE causes | 34 # Tests whose results failed to match expectations, but IGNOREFAILURE causes |
35 # us to take them less seriously. | 35 # us to take them less seriously. |
36 JSONKEY_ACTUALRESULTS_FAILUREIGNORED = 'failure-ignored' | 36 JSONKEY_ACTUALRESULTS_FAILUREIGNORED = 'failure-ignored' |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 68 |
69 # Optional: boolean indicating whether this expectation was reviewed/approved | 69 # Optional: boolean indicating whether this expectation was reviewed/approved |
70 # by a human being. | 70 # by a human being. |
71 # If True: a human looked at this image and approved it. | 71 # If True: a human looked at this image and approved it. |
72 # If False: this expectation was committed blind. (In such a case, please | 72 # If False: this expectation was committed blind. (In such a case, please |
73 # add notes indicating why!) | 73 # add notes indicating why!) |
74 # If absent: this expectation was committed by a tool that didn't enforce human | 74 # If absent: this expectation was committed by a tool that didn't enforce human |
75 # review of expectations. | 75 # review of expectations. |
76 JSONKEY_EXPECTEDRESULTS_REVIEWED = 'reviewed-by-human' | 76 JSONKEY_EXPECTEDRESULTS_REVIEWED = 'reviewed-by-human' |
77 | 77 |
78 | |
79 # Allowed hash types for test expectations. | 78 # Allowed hash types for test expectations. |
80 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' | 79 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' |
81 | 80 |
81 JSONKEY_HEADER = 'header' | |
82 JSONKEY_HEADER_TYPE = 'type' | |
83 JSONKEY_HEADER_REVISION = 'revision' | |
84 JSONKEY_IMAGE_CHECKSUMALGORITHM = 'checksumAlgorithm' | |
85 JSONKEY_IMAGE_CHECKSUMVALUE = 'checksumValue' | |
86 JSONKEY_IMAGE_COMPARISONRESULT = 'comparisonResult' | |
87 JSONKEY_IMAGE_FILEPATH = 'filepath' | |
88 JSONKEY_SOURCE_TILEDIMAGES = 'tiled-images' | |
89 JSONKEY_SOURCE_WHOLEIMAGE = 'whole-image' | |
90 | |
91 | |
82 # Root directory where the buildbots store their actually-generated images... | 92 # Root directory where the buildbots store their actually-generated images... |
83 # as a publicly readable HTTP URL: | 93 # as a publicly readable HTTP URL: |
84 GM_ACTUALS_ROOT_HTTP_URL = ( | 94 GM_ACTUALS_ROOT_HTTP_URL = ( |
85 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') | 95 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') |
86 # as a GS URL that allows credential-protected write access: | 96 # as a GS URL that allows credential-protected write access: |
87 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' | 97 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' |
88 | 98 |
89 # Root directory where buildbots store skimage actual results json files. | 99 # Root directory where buildbots store skimage actual results json files. |
90 SKIMAGE_ACTUALS_BASE_URL = ( | 100 SKIMAGE_ACTUALS_BASE_URL = ( |
91 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals') | 101 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals') |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 | 179 |
170 | 180 |
171 def WriteToFile(json_dict, file_path): | 181 def WriteToFile(json_dict, file_path): |
172 """Writes the JSON summary in json_dict out to file_path. | 182 """Writes the JSON summary in json_dict out to file_path. |
173 | 183 |
174 The file is written Unix-style (each line ends with just LF, not CRLF); | 184 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.""" | 185 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: | 186 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, | 187 outfile.write(unicode(json.dumps(json_dict, outfile, sort_keys=True, |
178 indent=2))) | 188 indent=2))) |
OLD | NEW |