Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 return files_to_rebaseline | 166 return files_to_rebaseline |
| 167 | 167 |
| 168 # Rebaseline a single file. | 168 # Rebaseline a single file. |
| 169 def _RebaselineOneFile(self, expectations_subdir, builder_name, | 169 def _RebaselineOneFile(self, expectations_subdir, builder_name, |
| 170 infilename, outfilename): | 170 infilename, outfilename): |
| 171 print '# ' + infilename | 171 print '# ' + infilename |
| 172 url = ('http://skia-autogen.googlecode.com/svn/gm-actual/' + | 172 url = ('http://skia-autogen.googlecode.com/svn/gm-actual/' + |
| 173 expectations_subdir + '/' + builder_name + '/' + | 173 expectations_subdir + '/' + builder_name + '/' + |
| 174 expectations_subdir + '/' + infilename) | 174 expectations_subdir + '/' + infilename) |
| 175 | 175 |
| 176 # Try to download this file, but if that fails, keep going... | 176 # Try to download this file. |
| 177 # | 177 # |
| 178 # This not treated as a fatal failure because not all | 178 # If the download fails, this will raise an exception and halt the |
| 179 # platforms generate all configs (e.g., Android does not | 179 # rebaseline process. Since the JSON results summary told us that |
| 180 # generate PDF). | 180 # this file needed rebaselining, we ought to be able to download it... |
| 181 # | 181 self._DownloadFile(source_url=url, dest_filename=outfilename) |
| 182 # We could tweak the list of configs within this tool to | |
| 183 # reflect which combinations the bots actually generate, and | |
| 184 # then fail if any of those expected combinations are | |
| 185 # missing... but then this tool would become useless every | |
| 186 # time someone tweaked the configs on the bots without | |
| 187 # updating this script. | |
| 188 try: | |
| 189 self._DownloadFile(source_url=url, dest_filename=outfilename) | |
| 190 except CommandFailedException: | |
| 191 print '# Couldn\'t fetch ' + url | |
| 192 return | |
| 193 | 182 |
| 194 # Add this file to version control (if it isn't already). | 183 # Add this file to version control (if it isn't already). |
| 195 if self._is_svn_checkout: | 184 if self._is_svn_checkout: |
| 196 cmd = [ 'svn', 'add', '--quiet', outfilename ] | 185 cmd = [ 'svn', 'add', '--quiet', outfilename ] |
| 197 self._Call(cmd) | 186 self._Call(cmd) |
| 198 cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', | 187 cmd = [ 'svn', 'propset', '--quiet', 'svn:mime-type', 'image/png', |
| 199 outfilename ]; | 188 outfilename ]; |
| 200 self._Call(cmd) | 189 self._Call(cmd) |
| 201 elif self._is_git_checkout: | 190 elif self._is_git_checkout: |
| 202 cmd = [ 'git', 'add', outfilename ] | 191 cmd = [ 'git', 'add', outfilename ] |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 outfilename=outfilename) | 241 outfilename=outfilename) |
| 253 | 242 |
| 254 # main... | 243 # main... |
| 255 | 244 |
| 256 parser = argparse.ArgumentParser() | 245 parser = argparse.ArgumentParser() |
| 257 parser.add_argument('--configs', metavar='CONFIG', nargs='+', | 246 parser.add_argument('--configs', metavar='CONFIG', nargs='+', |
| 258 help='which configurations to rebaseline, e.g. ' + | 247 help='which configurations to rebaseline, e.g. ' + |
| 259 '"--configs 565 8888"; if unspecified, run a default ' + | 248 '"--configs 565 8888"; if unspecified, run a default ' + |
| 260 'set of configs. This should ONLY be specified if ' + | 249 'set of configs. This should ONLY be specified if ' + |
| 261 '--tests has also been specified.') | 250 '--tests has also been specified.') |
| 262 parser.add_argument('--dry_run', action='store_true', | 251 parser.add_argument('--dry-run', action='store_true', |
|
epoger
2013/06/06 17:54:30
Patchset 2 renames the command-line arguments: use
| |
| 263 help='instead of actually downloading files or adding ' + | 252 help='instead of actually downloading files or adding ' + |
| 264 'files to checkout, display a list of operations that ' + | 253 'files to checkout, display a list of operations that ' + |
| 265 'we would normally perform') | 254 'we would normally perform') |
| 266 parser.add_argument('--json_base_url', | 255 parser.add_argument('--json-base-url', |
| 267 help='base URL from which to read JSON_FILENAME ' + | 256 help='base URL from which to read JSON_FILENAME ' + |
| 268 'files; defaults to %(default)s', | 257 'files; defaults to %(default)s', |
| 269 default='http://skia-autogen.googlecode.com/svn/gm-actual') | 258 default='http://skia-autogen.googlecode.com/svn/gm-actual') |
| 270 parser.add_argument('--json_filename', | 259 parser.add_argument('--json-filename', |
| 271 help='filename (under JSON_BASE_URL) to read a summary ' + | 260 help='filename (under JSON_BASE_URL) to read a summary ' + |
| 272 'of results from; defaults to %(default)s', | 261 'of results from; defaults to %(default)s', |
| 273 default='actual-results.json') | 262 default='actual-results.json') |
| 274 parser.add_argument('--subdirs', metavar='SUBDIR', nargs='+', | 263 parser.add_argument('--subdirs', metavar='SUBDIR', nargs='+', |
| 275 help='which platform subdirectories to rebaseline; ' + | 264 help='which platform subdirectories to rebaseline; ' + |
| 276 'if unspecified, rebaseline all subdirs, same as ' + | 265 'if unspecified, rebaseline all subdirs, same as ' + |
| 277 '"--subdirs %s"' % ' '.join(sorted(SUBDIR_MAPPING.keys()))) | 266 '"--subdirs %s"' % ' '.join(sorted(SUBDIR_MAPPING.keys()))) |
| 278 parser.add_argument('--tests', metavar='TEST', nargs='+', | 267 parser.add_argument('--tests', metavar='TEST', nargs='+', |
| 279 help='which tests to rebaseline, e.g. ' + | 268 help='which tests to rebaseline, e.g. ' + |
| 280 '"--tests aaclip bigmatrix"; if unspecified, then all ' + | 269 '"--tests aaclip bigmatrix"; if unspecified, then all ' + |
| 281 'failing tests (according to the actual-results.json ' + | 270 'failing tests (according to the actual-results.json ' + |
| 282 'file) will be rebaselined.') | 271 'file) will be rebaselined.') |
| 283 args = parser.parse_args() | 272 args = parser.parse_args() |
| 284 rebaseliner = Rebaseliner(tests=args.tests, configs=args.configs, | 273 rebaseliner = Rebaseliner(tests=args.tests, configs=args.configs, |
| 285 subdirs=args.subdirs, dry_run=args.dry_run, | 274 subdirs=args.subdirs, dry_run=args.dry_run, |
| 286 json_base_url=args.json_base_url, | 275 json_base_url=args.json_base_url, |
| 287 json_filename=args.json_filename) | 276 json_filename=args.json_filename) |
| 288 rebaseliner.RebaselineAll() | 277 rebaseliner.RebaselineAll() |
| OLD | NEW |