Fix bench_pictures.cfg and add sanity check

Review URL: https://codereview.appspot.com/6946052

git-svn-id: http://skia.googlecode.com/svn/trunk@6822 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
borenet@google.com 2012-12-14 14:56:37 +00:00
parent 441a005810
commit ddf36e73ac
3 changed files with 81 additions and 8 deletions

View File

@ -55,12 +55,12 @@ default_configs = [
TiledBitmapConfig(1024, 64),
# Different bounding box heirarchies, for different modes.
RecordConfig(bbh='rtree'),
RecordConfig(bbh='grid'),
PlaybackCreationConfig(bbh='rtree'),
PlaybackCreationConfig(bbh='grid'),
TiledBitmapConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y, bbh='rtree'),
TiledBitmapConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y, bbh='grid'),
RecordRTreeConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
PlaybackCreationRTreeConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
TileRTreeConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
RecordGridConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
PlaybackCreationGridConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
TileGridConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
]

View File

@ -42,5 +42,42 @@ def PlaybackCreationConfig(**kwargs):
def MultiThreadTileConfig(threads, tile_x, tile_y, **kwargs):
return TiledBitmapConfig(multi=threads, tile_x=tile_x, tile_y=tile_y,
**kwargs)
return TiledBitmapConfig(multi=str(threads), tile_x=tile_x, tile_y=tile_y,
**kwargs)
def RTreeConfig(tile_x, tile_y, mode, **kwargs):
return BitmapConfig(mode=mode, bbh=['rtree', str(tile_x), str(tile_y)],
**kwargs)
def GridConfig(tile_x, tile_y, mode, **kwargs):
return BitmapConfig(mode=mode, bbh=['grid', str(tile_x), str(tile_y)],
**kwargs)
def RecordRTreeConfig(tile_x, tile_y, **kwargs):
return RTreeConfig(tile_x=tile_x, tile_y=tile_y, mode='record', **kwargs)
def PlaybackCreationRTreeConfig(tile_x, tile_y, **kwargs):
return RTreeConfig(tile_x=tile_x, tile_y=tile_y, mode='playbackCreation',
**kwargs)
def TileRTreeConfig(tile_x, tile_y, **kwargs):
return RTreeConfig(tile_x=tile_x, tile_y=tile_y,
mode=['tile', str(tile_x), str(tile_y)], **kwargs)
def RecordGridConfig(tile_x, tile_y, **kwargs):
return GridConfig(tile_x=tile_x, tile_y=tile_y, mode='record', **kwargs)
def PlaybackCreationGridConfig(tile_x, tile_y, **kwargs):
return GridConfig(tile_x, tile_y, mode='playbackCreation')
def TileGridConfig(tile_x, tile_y, **kwargs):
return GridConfig(tile_x, tile_y, mode=['tile', str(tile_x), str(tile_y)],
**kwargs)

View File

@ -0,0 +1,36 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verify that the bench_pictures.cfg file is sane.
"""
import os
import sys
def Main(argv):
vars = {'import_path': 'tools'}
execfile(os.path.join('tools', 'bench_pictures.cfg'), vars)
bench_pictures_cfg = vars['bench_pictures_cfg']
for config_name, config_list in bench_pictures_cfg.iteritems():
if str(config_name) != config_name:
raise TypeError('%s is not a string!' % str(config_name))
for config in config_list:
for key, value in config.iteritems():
if str(key) != key:
raise TypeError('%s is not a string!\n%s' % (str(key), config))
if type(value).__name__ == 'list':
for item in value:
if str(item) != item:
raise TypeError('%s is not a string!\n%s' % (str(item), config))
else:
if str(value) != value:
raise TypeError('%s is not a string!\n%s' % (str(value), config))
if __name__ == '__main__':
sys.exit(Main(sys.argv))