Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ Run the Skia render_pictures executable. """ | 6 """ Run the Skia render_pictures executable. """ |
| 7 | 7 |
| 8 from build_step import BuildStep | 8 from build_step import BuildStep, BuildStepWarning |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| 11 | 11 |
| 12 | 12 |
| 13 DEFAULT_TILE_X = 256 | 13 DEFAULT_TILE_X = 256 |
| 14 DEFAULT_TILE_Y = 256 | 14 DEFAULT_TILE_Y = 256 |
| 15 JSON_SUMMARY_BASENAME = 'renderskp-' | 15 JSON_SUMMARY_FILENAME_FORMATTER = 'renderskp-%s.json' |
| 16 | 16 |
| 17 | 17 |
| 18 class RenderSKPs(BuildStep): | 18 class RenderSKPs(BuildStep): |
| 19 | |
| 19 def __init__(self, timeout=9600, no_output_timeout=9600, **kwargs): | 20 def __init__(self, timeout=9600, no_output_timeout=9600, **kwargs): |
| 20 super(RenderSKPs, self).__init__( | 21 super(RenderSKPs, self).__init__( |
| 21 timeout=timeout, no_output_timeout=no_output_timeout, **kwargs) | 22 timeout=timeout, no_output_timeout=no_output_timeout, **kwargs) |
| 22 | 23 |
| 23 def DoRenderSKPs(self, args, config='8888', write_images=True, | 24 |
| 24 json_summary_filename=None): | 25 def DoRenderSKPs(self, args, description, config='8888', write_images=True): |
| 25 """Run render_pictures. | 26 """Run render_pictures. |
| 26 | 27 |
| 27 Args: | 28 Args: |
| 28 args: (list of strings) misc args to append to the command line | 29 args: (list of strings) misc args to append to the command line |
| 30 description: (string) description of this RenderSKPs run; used as part | |
| 31 of the JSON summary filename | |
| 29 config: (string) which config to run in | 32 config: (string) which config to run in |
| 30 write_images: (boolean) whether to save the generated images (IGNORED) | 33 write_images: (boolean) whether to save the generated images (IGNORED) |
| 31 json_summary_filename: (string) name of file to write summary of actually- | 34 |
| 32 generated images into | 35 Raises: |
| 36 BuildStepWarning if there was a problem, but the step should keep going. | |
| 37 Something else if there was a major problem and we should give up now. | |
| 33 """ | 38 """ |
| 34 # For now, don't run on Android, since it takes too long and we don't use | 39 # For now, don't run on Android, since it takes too long and we don't use |
| 35 # the results. | 40 # the results. |
| 36 if 'Android' in self._builder_name: | 41 if 'Android' in self._builder_name: |
| 37 return | 42 return |
| 38 | 43 |
| 39 cmd = ['-r', self._device_dirs.SKPDir(), '--config', config, | 44 json_summary_filename = JSON_SUMMARY_FILENAME_FORMATTER % description |
| 40 '--mode', 'tile', str(DEFAULT_TILE_X), str(DEFAULT_TILE_Y)] | 45 json_expectations_devicepath = self._flavor_utils.DevicePathJoin( |
| 41 if json_summary_filename: | 46 self._device_dirs.PlaybackExpectedSummariesDir(), json_summary_filename) |
| 42 cmd.extend(['--writeJsonSummaryPath', os.path.join( | 47 if not self._flavor_utils.DevicePathExists(json_expectations_devicepath): |
| 43 self._device_dirs.SKPOutDir(), json_summary_filename)]) | 48 raise BuildStepWarning('could not find JSON expectations file %s' % |
| 49 json_expectations_devicepath) | |
| 50 | |
| 51 cmd = [ | |
| 52 '--config', config, | |
| 53 '--mode', 'tile', str(DEFAULT_TILE_X), str(DEFAULT_TILE_Y), | |
| 54 '--readJsonSummaryPath', json_expectations_devicepath, | |
| 55 '--readPath', self._device_dirs.SKPDir(), | |
| 56 '--writeChecksumBasedFilenames', | |
| 57 '--writeJsonSummaryPath', self._flavor_utils.DevicePathJoin( | |
| 58 self._device_dirs.PlaybackActualSummariesDir(), | |
| 59 json_summary_filename), | |
| 60 ] | |
| 61 if write_images: | |
| 62 cmd.extend([ | |
| 63 '--mismatchPath', self._device_dirs.PlaybackActualImagesDir()]) | |
| 44 cmd.extend(args) | 64 cmd.extend(args) |
| 45 | 65 |
| 46 if False: | 66 if False: |
| 47 # For now, skip --validate and writing images on all builders, since they | 67 # For now, skip --validate on all builders, since it takes more time, |
| 48 # take too long and we aren't making use of them. | 68 # and at last check failed on Windows. |
| 49 # Also skip --validate on Windows, where it is currently failing. | |
| 50 if write_images: | |
| 51 cmd.extend(['-w', self._device_dirs.SKPOutDir()]) | |
| 52 if not os.name == 'nt': | 69 if not os.name == 'nt': |
| 53 cmd.append('--validate') | 70 cmd.append('--validate') |
| 71 | |
| 54 self._flavor_utils.RunFlavoredCmd('render_pictures', cmd) | 72 self._flavor_utils.RunFlavoredCmd('render_pictures', cmd) |
| 55 | 73 |
| 74 | |
| 56 def _Run(self): | 75 def _Run(self): |
| 57 self.DoRenderSKPs( | 76 configs = { |
| 58 args=[], | 77 'defaults': [], |
| 59 json_summary_filename=JSON_SUMMARY_BASENAME + 'defaults.json') | 78 'deferImageDecoding': ['--deferImageDecoding', '--useVolatileCache'], |
| 60 self.DoRenderSKPs( | 79 'grid': ['--bbh', 'grid', str(DEFAULT_TILE_X), str(DEFAULT_TILE_X), |
| 61 args=['--bbh', 'grid', str(DEFAULT_TILE_X), str(DEFAULT_TILE_X), | 80 '--clone', '1'], |
| 62 '--clone', '1'], | 81 'rtree': ['--bbh', 'rtree', '--clone', '2'], |
| 63 json_summary_filename=JSON_SUMMARY_BASENAME + 'grid.json') | 82 } |
|
borenet
2014/05/19 21:04:38
It's possible that these belong in a config file i
epoger
2014/05/19 22:07:24
Yeah, maybe, I'm not sure. And maybe we should ev
| |
| 64 self.DoRenderSKPs( | 83 exceptions = [] |
| 65 args=['--bbh', 'rtree', '--clone', '2'], | 84 for description, args in sorted(configs.iteritems()): |
| 66 json_summary_filename=JSON_SUMMARY_BASENAME + 'rtree.json') | 85 try: |
| 67 self.DoRenderSKPs( | 86 self.DoRenderSKPs(args=args, description=description) |
| 68 args=['--deferImageDecoding', '--useVolatileCache'], | 87 except BuildStepWarning, e: |
| 69 json_summary_filename=JSON_SUMMARY_BASENAME + 'deferImageDecoding.json') | 88 exceptions.append(e) |
| 89 print e | |
| 90 if exceptions: | |
| 91 raise BuildStepWarning('\nGot %d exceptions:\n%s' % ( | |
| 92 len(exceptions), '\n'.join([repr(e) for e in exceptions]))) | |
| 70 | 93 |
| 71 | 94 |
| 72 if '__main__' == __name__: | 95 if '__main__' == __name__: |
| 73 sys.exit(BuildStep.RunBuildStep(RenderSKPs)) | 96 sys.exit(BuildStep.RunBuildStep(RenderSKPs)) |
| OLD | NEW |