Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: gm/gm_json.py

Issue 99373010: rebaseline_server: allow spaces within test/config names (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 # as a GS URL that allows credential-protected write access: 84 # as a GS URL that allows credential-protected write access:
85 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' 85 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm'
86 86
87 # Root directory where buildbots store skimage actual results json files. 87 # Root directory where buildbots store skimage actual results json files.
88 SKIMAGE_ACTUALS_BASE_URL = ( 88 SKIMAGE_ACTUALS_BASE_URL = (
89 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals') 89 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals')
90 # Root directory inside trunk where skimage expectations are stored. 90 # Root directory inside trunk where skimage expectations are stored.
91 SKIMAGE_EXPECTATIONS_ROOT = os.path.join('expectations', 'skimage') 91 SKIMAGE_EXPECTATIONS_ROOT = os.path.join('expectations', 'skimage')
92 92
93 # Pattern used to assemble each image's filename 93 # Pattern used to assemble each image's filename
94 IMAGE_FILENAME_PATTERN = '(\S+)_(\S+)\.png' # matches (testname, config) 94 IMAGE_FILENAME_PATTERN = '(.+)_(.+)\.png' # matches (testname, config)
95 95
96 def CreateGmActualUrl(test_name, hash_type, hash_digest, 96 def CreateGmActualUrl(test_name, hash_type, hash_digest,
97 gm_actuals_root_url=GM_ACTUALS_ROOT_HTTP_URL): 97 gm_actuals_root_url=GM_ACTUALS_ROOT_HTTP_URL):
98 """Return the URL we can use to download a particular version of 98 """Return the URL we can use to download a particular version of
99 the actually-generated image for this particular GM test. 99 the actually-generated image for this particular GM test.
100 100
101 test_name: name of the test, e.g. 'perlinnoise' 101 test_name: name of the test, e.g. 'perlinnoise'
102 hash_type: string indicating the hash type used to generate hash_digest, 102 hash_type: string indicating the hash type used to generate hash_digest,
103 e.g. JSONKEY_HASHTYPE_BITMAP_64BITMD5 103 e.g. JSONKEY_HASHTYPE_BITMAP_64BITMD5
104 hash_digest: the hash digest of the image to retrieve 104 hash_digest: the hash digest of the image to retrieve
(...skipping 20 matching lines...) Expand all
125 return LoadFromString(file_contents) 125 return LoadFromString(file_contents)
126 126
127 def WriteToFile(json_dict, file_path): 127 def WriteToFile(json_dict, file_path):
128 """Writes the JSON summary in json_dict out to file_path. 128 """Writes the JSON summary in json_dict out to file_path.
129 129
130 The file is written Unix-style (each line ends with just LF, not CRLF); 130 The file is written Unix-style (each line ends with just LF, not CRLF);
131 see https://code.google.com/p/skia/issues/detail?id=1815 for reasons.""" 131 see https://code.google.com/p/skia/issues/detail?id=1815 for reasons."""
132 with io.open(file_path, mode='w', newline='', encoding='utf-8') as outfile: 132 with io.open(file_path, mode='w', newline='', encoding='utf-8') as outfile:
133 outfile.write(unicode(json.dumps(json_dict, outfile, sort_keys=True, 133 outfile.write(unicode(json.dumps(json_dict, outfile, sort_keys=True,
134 indent=2))) 134 indent=2)))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698