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 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' | 76 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' |
77 | 77 |
78 # Root directory where the buildbots store their actually-generated images... | 78 # Root directory where the buildbots store their actually-generated images... |
79 # as a publicly readable HTTP URL: | 79 # as a publicly readable HTTP URL: |
80 GM_ACTUALS_ROOT_HTTP_URL = ( | 80 GM_ACTUALS_ROOT_HTTP_URL = ( |
81 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') | 81 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') |
82 # as a GS URL that allows credential-protected write access: | 82 # as a GS URL that allows credential-protected write access: |
83 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' | 83 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' |
84 | 84 |
85 # Pattern used to assemble each image's filename | 85 # Pattern used to assemble each image's filename |
86 IMAGE_FILENAME_PATTERN = '(\S+)_(\S+).png' # matches (testname, config) | 86 IMAGE_FILENAME_PATTERN = '(\S+)_(\S+)\.png' # matches (testname, config) |
87 | 87 |
88 def CreateGmActualUrl(test_name, hash_type, hash_digest, | 88 def CreateGmActualUrl(test_name, hash_type, hash_digest, |
89 gm_actuals_root_url=GM_ACTUALS_ROOT_HTTP_URL): | 89 gm_actuals_root_url=GM_ACTUALS_ROOT_HTTP_URL): |
90 """Return the URL we can use to download a particular version of | 90 """Return the URL we can use to download a particular version of |
91 the actually-generated image for this particular GM test. | 91 the actually-generated image for this particular GM test. |
92 | 92 |
93 test_name: name of the test, e.g. 'perlinnoise' | 93 test_name: name of the test, e.g. 'perlinnoise' |
94 hash_type: string indicating the hash type used to generate hash_digest, | 94 hash_type: string indicating the hash type used to generate hash_digest, |
95 e.g. JSONKEY_HASHTYPE_BITMAP_64BITMD5 | 95 e.g. JSONKEY_HASHTYPE_BITMAP_64BITMD5 |
96 hash_digest: the hash digest of the image to retrieve | 96 hash_digest: the hash digest of the image to retrieve |
(...skipping 16 matching lines...) Expand all Loading... |
113 """Loads the JSON summary written out by the GM tool. | 113 """Loads the JSON summary written out by the GM tool. |
114 Returns a dictionary keyed by the values listed as JSONKEY_ constants | 114 Returns a dictionary keyed by the values listed as JSONKEY_ constants |
115 above.""" | 115 above.""" |
116 file_contents = open(file_path, 'r').read() | 116 file_contents = open(file_path, 'r').read() |
117 return LoadFromString(file_contents) | 117 return LoadFromString(file_contents) |
118 | 118 |
119 def WriteToFile(json_dict, file_path): | 119 def WriteToFile(json_dict, file_path): |
120 """Writes the JSON summary in json_dict out to file_path.""" | 120 """Writes the JSON summary in json_dict out to file_path.""" |
121 with open(file_path, 'w') as outfile: | 121 with open(file_path, 'w') as outfile: |
122 json.dump(json_dict, outfile, sort_keys=True, indent=2) | 122 json.dump(json_dict, outfile, sort_keys=True, indent=2) |
OLD | NEW |