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

Side by Side Diff: tools/rebaseline.py

Issue 16509006: rebaseline.py: improve readability of dry-run output (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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/tests/rebaseline/output/all/output-expected/stdout » ('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/python 1 #!/usr/bin/python
2 2
3 ''' 3 '''
4 Copyright 2012 Google Inc. 4 Copyright 2012 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 ''' 8 '''
9 9
10 ''' 10 '''
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 # - if false: we will log an error message but return an empty list so we 152 # - if false: we will log an error message but return an empty list so we
153 # go on to the next platform 153 # go on to the next platform
154 # 154 #
155 # params: 155 # params:
156 # json_url: URL pointing to a JSON actual result summary file 156 # json_url: URL pointing to a JSON actual result summary file
157 # 157 #
158 # TODO(epoger): add a parameter indicating whether "no-comparison" 158 # TODO(epoger): add a parameter indicating whether "no-comparison"
159 # results (those for which we don't have any expectations yet) 159 # results (those for which we don't have any expectations yet)
160 # should be rebaselined. For now, we only return failed expectations. 160 # should be rebaselined. For now, we only return failed expectations.
161 def _GetFilesToRebaseline(self, json_url): 161 def _GetFilesToRebaseline(self, json_url):
162 if self._dry_run:
163 print ''
164 print '#'
162 print ('# Getting files to rebaseline from JSON summary URL %s ...' 165 print ('# Getting files to rebaseline from JSON summary URL %s ...'
163 % json_url) 166 % json_url)
164 try: 167 try:
165 json_contents = self._GetContentsOfUrl(json_url) 168 json_contents = self._GetContentsOfUrl(json_url)
166 except urllib2.HTTPError: 169 except urllib2.HTTPError:
167 message = 'unable to load JSON summary URL %s' % json_url 170 message = 'unable to load JSON summary URL %s' % json_url
168 if self._missing_json_is_fatal: 171 if self._missing_json_is_fatal:
169 raise ValueError(message) 172 raise ValueError(message)
170 else: 173 else:
171 print '# %s' % message 174 print '# %s' % message
172 return [] 175 return []
173 176
174 json_dict = gm_json.LoadFromString(json_contents) 177 json_dict = gm_json.LoadFromString(json_contents)
175 actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS] 178 actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS]
176 179
177 files_to_rebaseline = [] 180 files_to_rebaseline = []
178 failed_results = actual_results[gm_json.JSONKEY_ACTUALRESULTS_FAILED] 181 failed_results = actual_results[gm_json.JSONKEY_ACTUALRESULTS_FAILED]
179 if failed_results: 182 if failed_results:
180 files_to_rebaseline.extend(failed_results.keys()) 183 files_to_rebaseline.extend(failed_results.keys())
181 184
182 print '# ... found files_to_rebaseline %s' % files_to_rebaseline 185 print '# ... found files_to_rebaseline %s' % files_to_rebaseline
186 if self._dry_run:
187 print '#'
183 return files_to_rebaseline 188 return files_to_rebaseline
184 189
185 # Rebaseline a single file. 190 # Rebaseline a single file.
186 def _RebaselineOneFile(self, expectations_subdir, builder_name, 191 def _RebaselineOneFile(self, expectations_subdir, builder_name,
187 infilename, outfilename): 192 infilename, outfilename):
193 if self._dry_run:
194 print ''
188 print '# ' + infilename 195 print '# ' + infilename
189 url = ('http://skia-autogen.googlecode.com/svn/gm-actual/' + 196 url = ('http://skia-autogen.googlecode.com/svn/gm-actual/' +
190 expectations_subdir + '/' + builder_name + '/' + 197 expectations_subdir + '/' + builder_name + '/' +
191 expectations_subdir + '/' + infilename) 198 expectations_subdir + '/' + infilename)
192 199
193 # Try to download this file, but if that fails, keep going... 200 # Try to download this file, but if that fails, keep going...
194 # 201 #
195 # This not treated as a fatal failure because not all 202 # This not treated as a fatal failure because not all
196 # platforms generate all configs (e.g., Android does not 203 # platforms generate all configs (e.g., Android does not
197 # generate PDF). 204 # generate PDF).
(...skipping 29 matching lines...) Expand all
227 # test: a single test to rebaseline 234 # test: a single test to rebaseline
228 def _RebaselineOneTest(self, expectations_subdir, builder_name, test): 235 def _RebaselineOneTest(self, expectations_subdir, builder_name, test):
229 if self._configs: 236 if self._configs:
230 configs = self._configs 237 configs = self._configs
231 else: 238 else:
232 if (expectations_subdir == 'base-shuttle-win7-intel-angle'): 239 if (expectations_subdir == 'base-shuttle-win7-intel-angle'):
233 configs = [ 'angle', 'anglemsaa16' ] 240 configs = [ 'angle', 'anglemsaa16' ]
234 else: 241 else:
235 configs = [ '565', '8888', 'gpu', 'pdf', 'mesa', 'msaa16', 242 configs = [ '565', '8888', 'gpu', 'pdf', 'mesa', 'msaa16',
236 'msaa4' ] 243 'msaa4' ]
244 if self._dry_run:
245 print ''
237 print '# ' + expectations_subdir + ':' 246 print '# ' + expectations_subdir + ':'
238 for config in configs: 247 for config in configs:
239 infilename = test + '_' + config + '.png' 248 infilename = test + '_' + config + '.png'
240 outfilename = os.path.join(expectations_subdir, infilename); 249 outfilename = os.path.join(expectations_subdir, infilename);
241 self._RebaselineOneFile(expectations_subdir=expectations_subdir, 250 self._RebaselineOneFile(expectations_subdir=expectations_subdir,
242 builder_name=builder_name, 251 builder_name=builder_name,
243 infilename=infilename, 252 infilename=infilename,
244 outfilename=outfilename) 253 outfilename=outfilename)
245 254
246 # Rebaseline all platforms/tests/types we specified in the constructor. 255 # Rebaseline all platforms/tests/types we specified in the constructor.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 help='which tests to rebaseline, e.g. ' + 305 help='which tests to rebaseline, e.g. ' +
297 '"--tests aaclip bigmatrix"; if unspecified, then all ' + 306 '"--tests aaclip bigmatrix"; if unspecified, then all ' +
298 'failing tests (according to the actual-results.json ' + 307 'failing tests (according to the actual-results.json ' +
299 'file) will be rebaselined.') 308 'file) will be rebaselined.')
300 args = parser.parse_args() 309 args = parser.parse_args()
301 rebaseliner = Rebaseliner(tests=args.tests, configs=args.configs, 310 rebaseliner = Rebaseliner(tests=args.tests, configs=args.configs,
302 subdirs=args.subdirs, dry_run=args.dry_run, 311 subdirs=args.subdirs, dry_run=args.dry_run,
303 json_base_url=args.json_base_url, 312 json_base_url=args.json_base_url,
304 json_filename=args.json_filename) 313 json_filename=args.json_filename)
305 rebaseliner.RebaselineAll() 314 rebaseliner.RebaselineAll()
OLDNEW
« no previous file with comments | « no previous file | tools/tests/rebaseline/output/all/output-expected/stdout » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698