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

git-svn-id: http://skia.googlecode.com/svn/trunk@6847 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
borenet@google.com 2012-12-17 17:21:04 +00:00
parent 5f8c8f4486
commit 3b98bfd402
2 changed files with 23 additions and 13 deletions

View File

@ -55,12 +55,12 @@ default_configs = [
TiledBitmapConfig(1024, 64),
# Different bounding box heirarchies, for different modes.
RecordRTreeConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
RecordRTreeConfig( DEFAULT_TILE_X, DEFAULT_TILE_Y),
RecordGridConfig( 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),
PlaybackCreationGridConfig( DEFAULT_TILE_X, DEFAULT_TILE_Y),
TileRTreeConfig( DEFAULT_TILE_X, DEFAULT_TILE_Y),
TileGridConfig( DEFAULT_TILE_X, DEFAULT_TILE_Y),
]

View File

@ -12,25 +12,35 @@ import os
import sys
def ThrowIfNotAString(obj):
""" Raise a TypeError if obj is not a string. """
if str(obj) != obj:
raise TypeError('%s is not a string!' % str(obj))
def Main(argv):
""" Verify that the bench_pictures.cfg file is sane.
- Exec the file to ensure that it uses correct Python syntax.
- Make sure that every element is a string, because the buildbot scripts will
fail to execute if this is not the case.
This test does not verify that the well-formed configs are actually valid.
"""
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))
ThrowIfNotAString(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))
ThrowIfNotAString(key)
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))
ThrowIfNotAString(item)
else:
if str(value) != value:
raise TypeError('%s is not a string!\n%s' % (str(value), config))
ThrowIfNotAString(value)
if __name__ == '__main__':
sys.exit(Main(sys.argv))