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

Side by Side Diff: gm/gm_json.py

Issue 26666004: Add ability to rebaseline skimage to rebaseline.py (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/rebaseline.py » ('j') | 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
11 __author__ = 'Elliot Poger' 11 __author__ = 'Elliot Poger'
12 12
13 13
14 # system-level imports 14 # system-level imports
15 import json 15 import json
16 import os
16 17
17 18
18 # Key strings used in GM results JSON files (both expected-results.json and 19 # Key strings used in GM results JSON files (both expected-results.json and
19 # actual-results.json). 20 # actual-results.json).
20 # 21 #
21 # These constants must be kept in sync with the kJsonKey_ constants in 22 # These constants must be kept in sync with the kJsonKey_ constants in
22 # gm_expectations.cpp ! 23 # gm_expectations.cpp !
23 24
24 25
25 JSONKEY_ACTUALRESULTS = 'actual-results' 26 JSONKEY_ACTUALRESULTS = 'actual-results'
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 # Allowed hash types for test expectations. 76 # Allowed hash types for test expectations.
76 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5' 77 JSONKEY_HASHTYPE_BITMAP_64BITMD5 = 'bitmap-64bitMD5'
77 78
78 # Root directory where the buildbots store their actually-generated images... 79 # Root directory where the buildbots store their actually-generated images...
79 # as a publicly readable HTTP URL: 80 # as a publicly readable HTTP URL:
80 GM_ACTUALS_ROOT_HTTP_URL = ( 81 GM_ACTUALS_ROOT_HTTP_URL = (
81 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') 82 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm')
82 # as a GS URL that allows credential-protected write access: 83 # as a GS URL that allows credential-protected write access:
83 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm' 84 GM_ACTUALS_ROOT_GS_URL = 'gs://chromium-skia-gm/gm'
84 85
86 # Root directory where buildbots store skimage actual results json files.
87 SKIMAGE_ACTUALS_BASE_URL = (
88 'http://chromium-skia-gm.commondatastorage.googleapis.com/skimage/actuals')
89 # Root directory inside trunk where skimage expectations are stored.
90 SKIMAGE_EXPECTATIONS_ROOT = os.path.join('expectations', 'skimage')
91
85 # Pattern used to assemble each image's filename 92 # Pattern used to assemble each image's filename
86 IMAGE_FILENAME_PATTERN = '(\S+)_(\S+)\.png' # matches (testname, config) 93 IMAGE_FILENAME_PATTERN = '(\S+)_(\S+)\.png' # matches (testname, config)
87 94
88 def CreateGmActualUrl(test_name, hash_type, hash_digest, 95 def CreateGmActualUrl(test_name, hash_type, hash_digest,
89 gm_actuals_root_url=GM_ACTUALS_ROOT_HTTP_URL): 96 gm_actuals_root_url=GM_ACTUALS_ROOT_HTTP_URL):
90 """Return the URL we can use to download a particular version of 97 """Return the URL we can use to download a particular version of
91 the actually-generated image for this particular GM test. 98 the actually-generated image for this particular GM test.
92 99
93 test_name: name of the test, e.g. 'perlinnoise' 100 test_name: name of the test, e.g. 'perlinnoise'
94 hash_type: string indicating the hash type used to generate hash_digest, 101 hash_type: string indicating the hash type used to generate hash_digest,
(...skipping 18 matching lines...) Expand all
113 """Loads the JSON summary written out by the GM tool. 120 """Loads the JSON summary written out by the GM tool.
114 Returns a dictionary keyed by the values listed as JSONKEY_ constants 121 Returns a dictionary keyed by the values listed as JSONKEY_ constants
115 above.""" 122 above."""
116 file_contents = open(file_path, 'r').read() 123 file_contents = open(file_path, 'r').read()
117 return LoadFromString(file_contents) 124 return LoadFromString(file_contents)
118 125
119 def WriteToFile(json_dict, file_path): 126 def WriteToFile(json_dict, file_path):
120 """Writes the JSON summary in json_dict out to file_path.""" 127 """Writes the JSON summary in json_dict out to file_path."""
121 with open(file_path, 'w') as outfile: 128 with open(file_path, 'w') as outfile:
122 json.dump(json_dict, outfile, sort_keys=True, indent=2) 129 json.dump(json_dict, outfile, sort_keys=True, indent=2)
OLDNEW
« no previous file with comments | « no previous file | tools/rebaseline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698