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

Side by Side Diff: trunk/tools/rebaseline.py

Issue 19668009: Move gm-expected to trunk/expectations/gm , and modify scripts that use it. (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: add_master_files 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 | « gm-expected/base-win/expected-results.json ('k') | trunk/tools/svndiff.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 '''
11 Rebaselines the given GM tests, on all bots and all configurations. 11 Rebaselines the given GM tests, on all bots and all configurations.
12 Must be run from the gm-expected directory. If run from a git or SVN
13 checkout, the files will be added to the staging area for commit.
14 12
15 TODO(epoger): Fix indentation in this file (2-space indents, not 4-space). 13 TODO(epoger): Fix indentation in this file (2-space indents, not 4-space).
16 ''' 14 '''
17 15
18 # System-level imports 16 # System-level imports
19 import argparse 17 import argparse
20 import os 18 import os
21 import re 19 import re
22 import sys 20 import sys
23 import urllib2 21 import urllib2
(...skipping 11 matching lines...) Expand all
35 # 33 #
36 # This assumes that the 'gm' directory has been checked out as a sibling of 34 # This assumes that the 'gm' directory has been checked out as a sibling of
37 # the 'tools' directory containing this script, which will be the case if 35 # the 'tools' directory containing this script, which will be the case if
38 # 'trunk' was checked out as a single unit. 36 # 'trunk' was checked out as a single unit.
39 GM_DIRECTORY = os.path.realpath( 37 GM_DIRECTORY = os.path.realpath(
40 os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gm')) 38 os.path.join(os.path.dirname(os.path.dirname(__file__)), 'gm'))
41 if GM_DIRECTORY not in sys.path: 39 if GM_DIRECTORY not in sys.path:
42 sys.path.append(GM_DIRECTORY) 40 sys.path.append(GM_DIRECTORY)
43 import gm_json 41 import gm_json
44 42
45 # Mapping of gm-expectations subdir (under 43 # Mapping of expectations/gm subdir (under
46 # https://skia.googlecode.com/svn/gm-expected/ ) 44 # https://skia.googlecode.com/svn/trunk/expectations/gm/ )
47 # to builder name (see list at http://108.170.217.252:10117/builders ) 45 # to builder name (see list at http://108.170.217.252:10117/builders )
48 SUBDIR_MAPPING = { 46 SUBDIR_MAPPING = {
49 'base-shuttle-win7-intel-float': 47 'base-shuttle-win7-intel-float':
50 'Test-Win7-ShuttleA-HD2000-x86-Release', 48 'Test-Win7-ShuttleA-HD2000-x86-Release',
51 'base-shuttle-win7-intel-angle': 49 'base-shuttle-win7-intel-angle':
52 'Test-Win7-ShuttleA-HD2000-x86-Release-ANGLE', 50 'Test-Win7-ShuttleA-HD2000-x86-Release-ANGLE',
53 'base-shuttle-win7-intel-directwrite': 51 'base-shuttle-win7-intel-directwrite':
54 'Test-Win7-ShuttleA-HD2000-x86-Release-DirectWrite', 52 'Test-Win7-ShuttleA-HD2000-x86-Release-DirectWrite',
55 'base-shuttle_ubuntu12_ati5770': 53 'base-shuttle_ubuntu12_ati5770':
56 'Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release', 54 'Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release',
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS] 196 actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS]
199 if not sections: 197 if not sections:
200 sections = actual_results.keys() 198 sections = actual_results.keys()
201 for section in sections: 199 for section in sections:
202 section_results = actual_results[section] 200 section_results = actual_results[section]
203 if section_results: 201 if section_results:
204 results_to_return.update(section_results) 202 results_to_return.update(section_results)
205 return results_to_return 203 return results_to_return
206 204
207 # Rebaseline all tests/types we specified in the constructor, 205 # Rebaseline all tests/types we specified in the constructor,
208 # within this gm-expectations subdir. 206 # within this expectations/gm subdir.
209 # 207 #
210 # params: 208 # params:
211 # subdir : e.g. 'base-shuttle-win7-intel-float' 209 # subdir : e.g. 'base-shuttle-win7-intel-float'
212 # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release' 210 # builder : e.g. 'Test-Win7-ShuttleA-HD2000-x86-Release'
213 def RebaselineSubdir(self, subdir, builder): 211 def RebaselineSubdir(self, subdir, builder):
214 # Read in the actual result summary, and extract all the tests whose 212 # Read in the actual result summary, and extract all the tests whose
215 # results we need to update. 213 # results we need to update.
216 actuals_url = '/'.join([self._actuals_base_url, 214 actuals_url = '/'.join([self._actuals_base_url,
217 subdir, builder, subdir, 215 subdir, builder, subdir,
218 self._actuals_filename]) 216 self._actuals_filename])
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 'we would normally perform') 287 'we would normally perform')
290 parser.add_argument('--expectations-filename', 288 parser.add_argument('--expectations-filename',
291 help='filename (under EXPECTATIONS_ROOT) to read ' + 289 help='filename (under EXPECTATIONS_ROOT) to read ' +
292 'current expectations from, and to write new ' + 290 'current expectations from, and to write new ' +
293 'expectations into; defaults to %(default)s', 291 'expectations into; defaults to %(default)s',
294 default='expected-results.json') 292 default='expected-results.json')
295 parser.add_argument('--expectations-root', 293 parser.add_argument('--expectations-root',
296 help='root of expectations directory to update-- should ' + 294 help='root of expectations directory to update-- should ' +
297 'contain one or more base-* subdirectories. Defaults to ' + 295 'contain one or more base-* subdirectories. Defaults to ' +
298 '%(default)s', 296 '%(default)s',
299 default='.') 297 default=os.path.join('expectations', 'gm'))
300 parser.add_argument('--keep-going-on-failure', action='store_true', 298 parser.add_argument('--keep-going-on-failure', action='store_true',
301 help='instead of halting at the first error encountered, ' + 299 help='instead of halting at the first error encountered, ' +
302 'keep going and rebaseline as many tests as possible, ' + 300 'keep going and rebaseline as many tests as possible, ' +
303 'and then report the full set of errors at the end') 301 'and then report the full set of errors at the end')
304 parser.add_argument('--subdirs', metavar='SUBDIR', nargs='+', 302 parser.add_argument('--subdirs', metavar='SUBDIR', nargs='+',
305 help='which platform subdirectories to rebaseline; ' + 303 help='which platform subdirectories to rebaseline; ' +
306 'if unspecified, rebaseline all subdirs, same as ' + 304 'if unspecified, rebaseline all subdirs, same as ' +
307 '"--subdirs %s"' % ' '.join(sorted(SUBDIR_MAPPING.keys()))) 305 '"--subdirs %s"' % ' '.join(sorted(SUBDIR_MAPPING.keys())))
308 # TODO(epoger): Add test that exercises --tests argument. 306 # TODO(epoger): Add test that exercises --tests argument.
309 parser.add_argument('--tests', metavar='TEST', nargs='+', 307 parser.add_argument('--tests', metavar='TEST', nargs='+',
(...skipping 12 matching lines...) Expand all
322 missing_json_is_fatal = False 320 missing_json_is_fatal = False
323 for subdir in subdirs: 321 for subdir in subdirs:
324 if not subdir in SUBDIR_MAPPING.keys(): 322 if not subdir in SUBDIR_MAPPING.keys():
325 raise Exception(('unrecognized platform subdir "%s"; ' + 323 raise Exception(('unrecognized platform subdir "%s"; ' +
326 'should be one of %s') % ( 324 'should be one of %s') % (
327 subdir, SUBDIR_MAPPING.keys())) 325 subdir, SUBDIR_MAPPING.keys()))
328 builder = SUBDIR_MAPPING[subdir] 326 builder = SUBDIR_MAPPING[subdir]
329 327
330 # We instantiate different Rebaseliner objects depending 328 # We instantiate different Rebaseliner objects depending
331 # on whether we are rebaselining an expected-results.json file, or 329 # on whether we are rebaselining an expected-results.json file, or
332 # individual image files. Different gm-expected subdirectories may move 330 # individual image files. Different expectations/gm subdirectories may move
333 # from individual image files to JSON-format expectations at different 331 # from individual image files to JSON-format expectations at different
334 # times, so we need to make this determination per subdirectory. 332 # times, so we need to make this determination per subdirectory.
335 # 333 #
336 # See https://goto.google.com/ChecksumTransitionDetail 334 # See https://goto.google.com/ChecksumTransitionDetail
337 expectations_json_file = os.path.join(args.expectations_root, subdir, 335 expectations_json_file = os.path.join(args.expectations_root, subdir,
338 args.expectations_filename) 336 args.expectations_filename)
339 if os.path.isfile(expectations_json_file): 337 if os.path.isfile(expectations_json_file):
340 rebaseliner = JsonRebaseliner( 338 rebaseliner = JsonRebaseliner(
341 expectations_root=args.expectations_root, 339 expectations_root=args.expectations_root,
342 expectations_filename=args.expectations_filename, 340 expectations_filename=args.expectations_filename,
(...skipping 18 matching lines...) Expand all
361 exception_handler=exception_handler, 359 exception_handler=exception_handler,
362 add_new=args.add_new, 360 add_new=args.add_new,
363 missing_json_is_fatal=missing_json_is_fatal) 361 missing_json_is_fatal=missing_json_is_fatal)
364 362
365 try: 363 try:
366 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) 364 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder)
367 except BaseException as e: 365 except BaseException as e:
368 exception_handler.RaiseExceptionOrContinue(e) 366 exception_handler.RaiseExceptionOrContinue(e)
369 367
370 exception_handler.ReportAllFailures() 368 exception_handler.ReportAllFailures()
OLDNEW
« no previous file with comments | « gm-expected/base-win/expected-results.json ('k') | trunk/tools/svndiff.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698