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

Side by Side Diff: tools/tests/bench_pictures_cfg_test.py

Issue 796813004: Remove tools/tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5
6 """
7 Verify that the bench_pictures.cfg file is sane.
8 """
9
10
11 import os
12 import sys
13
14
15 def ThrowIfNotAString(obj):
16 """ Raise a TypeError if obj is not a string. """
17 if str(obj) != obj:
18 raise TypeError('%s is not a string!' % str(obj))
19
20
21 def Main(argv):
22 """ Verify that the bench_pictures.cfg file is sane.
23
24 - Exec the file to ensure that it uses correct Python syntax.
25 - Make sure that every element is a string, because the buildbot scripts will
26 fail to execute if this is not the case.
27
28 This test does not verify that the well-formed configs are actually valid.
29 """
30 vars = {'import_path': 'tools'}
31 execfile(os.path.join('tools', 'bench_pictures.cfg'), vars)
32 bench_pictures_cfg = vars['bench_pictures_cfg']
33
34 for config_name, config_list in bench_pictures_cfg.iteritems():
35 ThrowIfNotAString(config_name)
36 for config in config_list:
37 for key, value in config.iteritems():
38 ThrowIfNotAString(key)
39 if type(value).__name__ == 'list':
40 for item in value:
41 ThrowIfNotAString(item)
42 elif not value is True:
43 ThrowIfNotAString(value)
44
45 if __name__ == '__main__':
46 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « tools/tests/base_unittest.py ('k') | tools/tests/benchalerts/Perf-Android-Nexus7-Tegra3-Arm7-Release/expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698