OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 """ Look through skia-autogen, searching for all checksums which should have | 8 """ Look through skia-autogen, searching for all checksums which should have |
9 corresponding files in Google Storage, and verify that those files exist. """ | 9 corresponding files in Google Storage, and verify that those files exist. """ |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 def FindURLSInJSON(json_file, gs_urls): | 40 def FindURLSInJSON(json_file, gs_urls): |
41 """ Extract Google Storage URLs from a JSON file in svn, adding them to the | 41 """ Extract Google Storage URLs from a JSON file in svn, adding them to the |
42 gs_urls dictionary. | 42 gs_urls dictionary. |
43 | 43 |
44 json_file: string; URL of the JSON file. | 44 json_file: string; URL of the JSON file. |
45 gs_urls: dict; stores Google Storage URLs as keys and lists of the JSON files | 45 gs_urls: dict; stores Google Storage URLs as keys and lists of the JSON files |
46 which reference them. | 46 which reference them. |
47 | 47 |
48 Example gs_urls: | 48 Example gs_urls: |
49 { 'gs://chromium-skia-gm/gm/sometest/12345.png': [ | 49 { 'gs://chromium-skia-gm/gm/sometest/12345.png': [ |
50 'http://skia-autogen.googlecode.com/svn/gm-actual/base-macmini/Test-Mac10.
6-MacMini4.1-GeForce320M-x86-Debug/base-macmini/actual-results.json', | 50 'http://skia-autogen.googlecode.com/svn/gm-actual/Test-Mac10.6-MacMini4.1-
GeForce320M-x86-Debug/actual-results.json', |
51 'http://skia-autogen.googlecode.com/svn/gm-actual/base-macmini-10_8/Test-M
ac10.8-MacMini4.1-GeForce320M-x86-Debug/base-macmini-10_8/actual-results.json', | 51 'http://skia-autogen.googlecode.com/svn/gm-actual/Test-Mac10.8-MacMini4.1-
GeForce320M-x86-Debug/actual-results.json', |
52 ] | 52 ] |
53 } | 53 } |
54 """ | 54 """ |
55 output = subprocess.check_output(['svn', 'cat', json_file]) | 55 output = subprocess.check_output(['svn', 'cat', json_file]) |
56 json_content = json.loads(output) | 56 json_content = json.loads(output) |
57 for dict_type in ['actual-results']: | 57 for dict_type in ['actual-results']: |
58 for result_type in json_content[dict_type]: | 58 for result_type in json_content[dict_type]: |
59 if json_content[dict_type][result_type]: | 59 if json_content[dict_type][result_type]: |
60 for result in json_content[dict_type][result_type].keys(): | 60 for result in json_content[dict_type][result_type].keys(): |
61 hash_type, hash_value = json_content[dict_type][result_type][result] | 61 hash_type, hash_value = json_content[dict_type][result_type][result] |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 def FindURLs(url): | 105 def FindURLs(url): |
106 """ Find Google Storage URLs inside of JSON files in the given repository. | 106 """ Find Google Storage URLs inside of JSON files in the given repository. |
107 Returns a dictionary whose keys are Google Storage URLs and values are lists | 107 Returns a dictionary whose keys are Google Storage URLs and values are lists |
108 of the JSON files which reference them. | 108 of the JSON files which reference them. |
109 | 109 |
110 url: string; URL of the repository to explore. | 110 url: string; URL of the repository to explore. |
111 | 111 |
112 Example output: | 112 Example output: |
113 { 'gs://chromium-skia-gm/gm/sometest/12345.png': [ | 113 { 'gs://chromium-skia-gm/gm/sometest/12345.png': [ |
114 'http://skia-autogen.googlecode.com/svn/gm-actual/base-macmini/Test-Mac10.
6-MacMini4.1-GeForce320M-x86-Debug/base-macmini/actual-results.json', | 114 'http://skia-autogen.googlecode.com/svn/gm-actual/Test-Mac10.6-MacMini4.1-
GeForce320M-x86-Debug/actual-results.json', |
115 'http://skia-autogen.googlecode.com/svn/gm-actual/base-macmini-10_8/Test-M
ac10.8-MacMini4.1-GeForce320M-x86-Debug/base-macmini-10_8/actual-results.json', | 115 'http://skia-autogen.googlecode.com/svn/gm-actual/Test-Mac10.8-MacMini4.1-
GeForce320M-x86-Debug/actual-results.json', |
116 ] | 116 ] |
117 } | 117 } |
118 """ | 118 """ |
119 gs_urls = {} | 119 gs_urls = {} |
120 for json_file in FindJSONFiles(url): | 120 for json_file in FindJSONFiles(url): |
121 print 'Looking for checksums in %s' % json_file | 121 print 'Looking for checksums in %s' % json_file |
122 FindURLSInJSON(json_file, gs_urls) | 122 FindURLSInJSON(json_file, gs_urls) |
123 return gs_urls | 123 return gs_urls |
124 | 124 |
125 | 125 |
(...skipping 27 matching lines...) Expand all Loading... |
153 def Main(): | 153 def Main(): |
154 urls = FindURLs(AUTOGEN_URL) | 154 urls = FindURLs(AUTOGEN_URL) |
155 missing = VerifyURLs(urls) | 155 missing = VerifyURLs(urls) |
156 if missing: | 156 if missing: |
157 print 'Found %d Missing files.' % len(missing) | 157 print 'Found %d Missing files.' % len(missing) |
158 return 1 | 158 return 1 |
159 | 159 |
160 | 160 |
161 if __name__ == '__main__': | 161 if __name__ == '__main__': |
162 sys.exit(Main()) | 162 sys.exit(Main()) |
OLD | NEW |