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

Side by Side Diff: tools/rebaseline_imagefiles.py

Issue 18092004: rebaseline.py: add --keep-going-on-failure option, off by default (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: linewrap Created 7 years, 5 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 ''' 3 '''
4 Copyright 2013 Google Inc. 4 Copyright 2013 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class CommandFailedException(Exception): 46 class CommandFailedException(Exception):
47 pass 47 pass
48 48
49 class ImageRebaseliner(object): 49 class ImageRebaseliner(object):
50 50
51 # params: 51 # params:
52 # expectations_root: root directory of all expectations 52 # expectations_root: root directory of all expectations
53 # json_base_url: base URL from which to read json_filename 53 # json_base_url: base URL from which to read json_filename
54 # json_filename: filename (under json_base_url) from which to read a 54 # json_filename: filename (under json_base_url) from which to read a
55 # summary of results; typically "actual-results.json" 55 # summary of results; typically "actual-results.json"
56 # exception_handler: reference to rebaseline.ExceptionHandler object
56 # tests: list of tests to rebaseline, or None if we should rebaseline 57 # tests: list of tests to rebaseline, or None if we should rebaseline
57 # whatever files the JSON results summary file tells us to 58 # whatever files the JSON results summary file tells us to
58 # configs: which configs to run for each test, or None if we should 59 # configs: which configs to run for each test, or None if we should
59 # rebaseline whatever configs the JSON results summary file tells 60 # rebaseline whatever configs the JSON results summary file tells
60 # us to 61 # us to
61 # dry_run: if True, instead of actually downloading files or adding 62 # dry_run: if True, instead of actually downloading files or adding
62 # files to checkout, display a list of operations that 63 # files to checkout, display a list of operations that
63 # we would normally perform 64 # we would normally perform
64 # add_new: if True, add expectations for tests which don't have any yet 65 # add_new: if True, add expectations for tests which don't have any yet
65 # missing_json_is_fatal: whether to halt execution if we cannot read a 66 # missing_json_is_fatal: whether to halt execution if we cannot read a
66 # JSON actual result summary file 67 # JSON actual result summary file
67 def __init__(self, expectations_root, json_base_url, json_filename, 68 def __init__(self, expectations_root, json_base_url, json_filename,
68 tests=None, configs=None, dry_run=False, 69 exception_handler, tests=None, configs=None, dry_run=False,
69 add_new=False, missing_json_is_fatal=False): 70 add_new=False, missing_json_is_fatal=False):
70 self._expectations_root = expectations_root 71 self._expectations_root = expectations_root
71 self._tests = tests 72 self._tests = tests
72 self._configs = configs 73 self._configs = configs
73 self._json_base_url = json_base_url 74 self._json_base_url = json_base_url
74 self._json_filename = json_filename 75 self._json_filename = json_filename
76 self._exception_handler = exception_handler
75 self._dry_run = dry_run 77 self._dry_run = dry_run
76 self._add_new = add_new 78 self._add_new = add_new
77 self._missing_json_is_fatal = missing_json_is_fatal 79 self._missing_json_is_fatal = missing_json_is_fatal
78 self._googlestorage_gm_actuals_root = ( 80 self._googlestorage_gm_actuals_root = (
79 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm') 81 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm')
80 self._testname_pattern = re.compile('(\S+)_(\S+).png') 82 self._testname_pattern = re.compile('(\S+)_(\S+).png')
81 self._is_svn_checkout = ( 83 self._is_svn_checkout = (
82 os.path.exists(os.path.join(expectations_root, '.svn')) or 84 os.path.exists(os.path.join(expectations_root, '.svn')) or
83 os.path.exists(os.path.join(expectations_root, os.pardir, '.svn'))) 85 os.path.exists(os.path.join(expectations_root, os.pardir, '.svn')))
84 self._is_git_checkout = ( 86 self._is_git_checkout = (
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 self._Call(cmd) 249 self._Call(cmd)
248 250
249 # Rebaseline all tests/types we specified in the constructor, 251 # Rebaseline all tests/types we specified in the constructor,
250 # within this gm-expectations subdir. 252 # within this gm-expectations subdir.
251 # 253 #
252 # params: 254 # params:
253 # subdir : e.g. 'base-shuttle-win7-intel-float' 255 # subdir : e.g. 'base-shuttle-win7-intel-float'
254 # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release' 256 # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release'
255 def RebaselineSubdir(self, subdir, builder): 257 def RebaselineSubdir(self, subdir, builder):
256 if not os.path.isdir(os.path.join(self._expectations_root, subdir)): 258 if not os.path.isdir(os.path.join(self._expectations_root, subdir)):
257 raise Exception(( 259 self._exception_handler.RaiseExceptionOrContinue(Exception((
258 'Could not find "%s" subdir within expectations_root "%s". ' + 260 'Could not find "%s" subdir within expectations_root "%s". ' +
259 'Are you sure --expectations-root is pointing at a valid ' + 261 'Are you sure --expectations-root is pointing at a valid ' +
260 'gm-expected directory?') % (subdir, self._expectations_root)) 262 'gm-expected directory?') % (subdir, self._expectations_root)))
263 return
261 264
262 json_url = '/'.join([self._json_base_url, 265 json_url = '/'.join([self._json_base_url,
263 subdir, builder, subdir, 266 subdir, builder, subdir,
264 self._json_filename]) 267 self._json_filename])
265 all_results = self._GetActualResults(json_url=json_url) 268 all_results = self._GetActualResults(json_url=json_url)
266 filenames = self._GetFilesToRebaseline(json_url=json_url, 269 filenames = self._GetFilesToRebaseline(json_url=json_url,
267 add_new=self._add_new) 270 add_new=self._add_new)
268 skipped_files = [] 271 skipped_files = []
269 for filename in filenames: 272 for filename in filenames:
270 (test, config) = self._testname_pattern.match(filename).groups() 273 (test, config) = self._testname_pattern.match(filename).groups()
271 if self._tests: 274 if self._tests:
272 if test not in self._tests: 275 if test not in self._tests:
273 skipped_files.append(filename) 276 skipped_files.append(filename)
274 continue 277 continue
275 if self._configs: 278 if self._configs:
276 if config not in self._configs: 279 if config not in self._configs:
277 skipped_files.append(filename) 280 skipped_files.append(filename)
278 continue 281 continue
279 outfilename = os.path.join(self._expectations_root, subdir, 282 outfilename = os.path.join(self._expectations_root, subdir,
280 filename); 283 filename);
281 # TODO(epoger): Until we resolve
282 # https://code.google.com/p/skia/issues/detail?id=1410 ('some GM
283 # result images not available for download from Google Storage'),
284 # keep going in the face of missing results for any one test.
285 try: 284 try:
286 self._RebaselineOneFile(expectations_subdir=subdir, 285 self._RebaselineOneFile(expectations_subdir=subdir,
287 builder_name=builder, 286 builder_name=builder,
288 infilename=filename, 287 infilename=filename,
289 outfilename=outfilename, 288 outfilename=outfilename,
290 all_results=all_results) 289 all_results=all_results)
291 except Exception as e: 290 except BaseException as e:
292 print 'WARNING: swallowing exception %s' % e 291 self._exception_handler.RaiseExceptionOrContinue(e)
OLDNEW
« no previous file with comments | « tools/rebaseline.py ('k') | tools/tests/rebaseline/output/exercise-bug1403/output-expected/stdout » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698