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

Side by Side Diff: tools/rebaseline.py

Issue 18324018: rebaseline.py: use specified configs/tests as a FILTER over actually-run tests (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r9955 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
« no previous file with comments | « no previous file | tools/rebaseline_imagefiles.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/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 # params: 80 # params:
81 # expectations_root: root directory of all expectations JSON files 81 # expectations_root: root directory of all expectations JSON files
82 # expectations_filename: filename (under expectations_root) of JSON 82 # expectations_filename: filename (under expectations_root) of JSON
83 # expectations file; typically 83 # expectations file; typically
84 # "expected-results.json" 84 # "expected-results.json"
85 # actuals_base_url: base URL from which to read actual-result JSON files 85 # actuals_base_url: base URL from which to read actual-result JSON files
86 # actuals_filename: filename (under actuals_base_url) from which to read a 86 # actuals_filename: filename (under actuals_base_url) from which to read a
87 # summary of results; typically "actual-results.json" 87 # summary of results; typically "actual-results.json"
88 # tests: list of tests to rebaseline, or None if we should rebaseline 88 # tests: list of tests to rebaseline, or None if we should rebaseline
89 # whatever files the JSON results summary file tells us to 89 # whatever files the JSON results summary file tells us to
90 # configs: which configs to run for each test; this should only be 90 # configs: which configs to run for each test, or None if we should
91 # specified if the list of tests was also specified (otherwise, 91 # rebaseline whatever configs the JSON results summary file tells
92 # the JSON file will give us test names and configs) 92 # us to
93 # add_new: if True, add expectations for tests which don't have any yet 93 # add_new: if True, add expectations for tests which don't have any yet
94 def __init__(self, expectations_root, expectations_filename, 94 def __init__(self, expectations_root, expectations_filename,
95 actuals_base_url, actuals_filename, 95 actuals_base_url, actuals_filename,
96 tests=None, configs=None, add_new=False): 96 tests=None, configs=None, add_new=False):
97 if configs and not tests:
98 raise ValueError('configs should only be specified if tests ' +
99 'were specified also')
100 self._expectations_root = expectations_root 97 self._expectations_root = expectations_root
101 self._expectations_filename = expectations_filename 98 self._expectations_filename = expectations_filename
102 self._tests = tests 99 self._tests = tests
103 self._configs = configs 100 self._configs = configs
104 self._actuals_base_url = actuals_base_url 101 self._actuals_base_url = actuals_base_url
105 self._actuals_filename = actuals_filename 102 self._actuals_filename = actuals_filename
106 self._add_new = add_new 103 self._add_new = add_new
107 self._testname_pattern = re.compile('(\S+)_(\S+).png') 104 self._testname_pattern = re.compile('(\S+)_(\S+).png')
108 105
109 # Returns the full contents of filepath, as a single string. 106 # Returns the full contents of filepath, as a single string.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 'of ACTUALS_BASE_URL) to read a summary of results from; ' + 205 'of ACTUALS_BASE_URL) to read a summary of results from; ' +
209 'defaults to %(default)s', 206 'defaults to %(default)s',
210 default='actual-results.json') 207 default='actual-results.json')
211 # TODO(epoger): Add test that exercises --add-new argument. 208 # TODO(epoger): Add test that exercises --add-new argument.
212 parser.add_argument('--add-new', action='store_true', 209 parser.add_argument('--add-new', action='store_true',
213 help='in addition to the standard behavior of ' + 210 help='in addition to the standard behavior of ' +
214 'updating expectations for failing tests, add ' + 211 'updating expectations for failing tests, add ' +
215 'expectations for tests which don\'t have expectations ' + 212 'expectations for tests which don\'t have expectations ' +
216 'yet.') 213 'yet.')
217 # TODO(epoger): Add test that exercises --configs argument. 214 # TODO(epoger): Add test that exercises --configs argument.
218 # TODO(epoger): Once we are only rebaselining JSON files, update the helpstring
219 # to indicate that this is a *filter* over the config names that
220 # actual-results.json tells us need to be rebaselined.
221 # You don't need to specify tests also, etc.
222 parser.add_argument('--configs', metavar='CONFIG', nargs='+', 215 parser.add_argument('--configs', metavar='CONFIG', nargs='+',
223 help='which configurations to rebaseline, e.g. ' + 216 help='which configurations to rebaseline, e.g. ' +
224 '"--configs 565 8888"; if unspecified, run a default ' + 217 '"--configs 565 8888", as a filter over the full set of ' +
225 'set of configs. This should ONLY be specified if ' + 218 'results in ACTUALS_FILENAME; if unspecified, rebaseline ' +
226 '--tests has also been specified.') 219 '*all* configs that are available.')
227 # TODO(epoger): The --dry-run argument will no longer be needed once we 220 # TODO(epoger): The --dry-run argument will no longer be needed once we
228 # are only rebaselining JSON files. 221 # are only rebaselining JSON files.
229 parser.add_argument('--dry-run', action='store_true', 222 parser.add_argument('--dry-run', action='store_true',
230 help='instead of actually downloading files or adding ' + 223 help='instead of actually downloading files or adding ' +
231 'files to checkout, display a list of operations that ' + 224 'files to checkout, display a list of operations that ' +
232 'we would normally perform') 225 'we would normally perform')
233 parser.add_argument('--expectations-filename', 226 parser.add_argument('--expectations-filename',
234 help='filename (under EXPECTATIONS_ROOT) to read ' + 227 help='filename (under EXPECTATIONS_ROOT) to read ' +
235 'current expectations from, and to write new ' + 228 'current expectations from, and to write new ' +
236 'expectations into; defaults to %(default)s', 229 'expectations into; defaults to %(default)s',
237 default='expected-results.json') 230 default='expected-results.json')
238 parser.add_argument('--expectations-root', 231 parser.add_argument('--expectations-root',
239 help='root of expectations directory to update-- should ' + 232 help='root of expectations directory to update-- should ' +
240 'contain one or more base-* subdirectories. Defaults to ' + 233 'contain one or more base-* subdirectories. Defaults to ' +
241 '%(default)s', 234 '%(default)s',
242 default='.') 235 default='.')
243 parser.add_argument('--subdirs', metavar='SUBDIR', nargs='+', 236 parser.add_argument('--subdirs', metavar='SUBDIR', nargs='+',
244 help='which platform subdirectories to rebaseline; ' + 237 help='which platform subdirectories to rebaseline; ' +
245 'if unspecified, rebaseline all subdirs, same as ' + 238 'if unspecified, rebaseline all subdirs, same as ' +
246 '"--subdirs %s"' % ' '.join(sorted(SUBDIR_MAPPING.keys()))) 239 '"--subdirs %s"' % ' '.join(sorted(SUBDIR_MAPPING.keys())))
247 # TODO(epoger): Add test that exercises --tests argument. 240 # TODO(epoger): Add test that exercises --tests argument.
248 # TODO(epoger): Once we are only rebaselining JSON files, update the helpstring
249 # to indicate that this is a *filter* over the test names that
250 # actual-results.json tells us need to be rebaselined.
251 parser.add_argument('--tests', metavar='TEST', nargs='+', 241 parser.add_argument('--tests', metavar='TEST', nargs='+',
252 help='which tests to rebaseline, e.g. ' + 242 help='which tests to rebaseline, e.g. ' +
253 '"--tests aaclip bigmatrix"; if unspecified, then all ' + 243 '"--tests aaclip bigmatrix", as a filter over the full ' +
254 'failing tests (according to the actual-results.json ' + 244 'set of results in ACTUALS_FILENAME; if unspecified, ' +
255 'file) will be rebaselined.') 245 'rebaseline *all* tests that are available.')
256 args = parser.parse_args() 246 args = parser.parse_args()
257 if args.subdirs: 247 if args.subdirs:
258 subdirs = args.subdirs 248 subdirs = args.subdirs
259 missing_json_is_fatal = True 249 missing_json_is_fatal = True
260 else: 250 else:
261 subdirs = sorted(SUBDIR_MAPPING.keys()) 251 subdirs = sorted(SUBDIR_MAPPING.keys())
262 missing_json_is_fatal = False 252 missing_json_is_fatal = False
263 for subdir in subdirs: 253 for subdir in subdirs:
264 if not subdir in SUBDIR_MAPPING.keys(): 254 if not subdir in SUBDIR_MAPPING.keys():
265 raise Exception(('unrecognized platform subdir "%s"; ' + 255 raise Exception(('unrecognized platform subdir "%s"; ' +
(...skipping 21 matching lines...) Expand all
287 else: 277 else:
288 rebaseliner = rebaseline_imagefiles.ImageRebaseliner( 278 rebaseliner = rebaseline_imagefiles.ImageRebaseliner(
289 expectations_root=args.expectations_root, 279 expectations_root=args.expectations_root,
290 tests=args.tests, configs=args.configs, 280 tests=args.tests, configs=args.configs,
291 dry_run=args.dry_run, 281 dry_run=args.dry_run,
292 json_base_url=args.actuals_base_url, 282 json_base_url=args.actuals_base_url,
293 json_filename=args.actuals_filename, 283 json_filename=args.actuals_filename,
294 add_new=args.add_new, 284 add_new=args.add_new,
295 missing_json_is_fatal=missing_json_is_fatal) 285 missing_json_is_fatal=missing_json_is_fatal)
296 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) 286 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder)
OLDNEW
« no previous file with comments | « no previous file | tools/rebaseline_imagefiles.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698