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

Side by Side Diff: tools/perf_expectations/tests/perf_expectations_unittest.py

Issue 9240017: Update expectations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change message, update copyright Created 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/perf_expectations/perf_expectations.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # 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
5 # found in the LICENSE file. 4 # found in the LICENSE file.
6 5
7 """Verify perf_expectations.json can be loaded using simplejson. 6 """Verify perf_expectations.json can be loaded using simplejson.
8 7
9 perf_expectations.json is a JSON-formatted file. This script verifies 8 perf_expectations.json is a JSON-formatted file. This script verifies
10 that simplejson can load it correctly. It should catch most common 9 that simplejson can load it correctly. It should catch most common
11 formatting problems. 10 formatting problems.
12 """ 11 """
13 12
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 # regular expression. 143 # regular expression.
145 if not re.match(r"^([\w\.-]+)/([\w\.-]+)/([\w\.-]+)/([\w\.-]+)$", key): 144 if not re.match(r"^([\w\.-]+)/([\w\.-]+)/([\w\.-]+)/([\w\.-]+)$", key):
146 bad_keys.append(key) 145 bad_keys.append(key)
147 if len(bad_keys) > 0: 146 if len(bad_keys) > 0:
148 msg = "perf expectations keys in bad format, expected a/b/c/d" 147 msg = "perf expectations keys in bad format, expected a/b/c/d"
149 raise Exception("%s: %s" % (msg, bad_keys)) 148 raise Exception("%s: %s" % (msg, bad_keys))
150 149
151 def testNoUpdatesNeeded(self): 150 def testNoUpdatesNeeded(self):
152 p = subprocess.Popen([MAKE_EXPECTATIONS, '-s'], stdout=subprocess.PIPE) 151 p = subprocess.Popen([MAKE_EXPECTATIONS, '-s'], stdout=subprocess.PIPE)
153 p.wait(); 152 p.wait();
154 self.assertEqual(p.returncode, 0, msg='Expectations has pending updates!') 153 self.assertEqual(p.returncode, 0,
154 msg='Update expectations first by running ./make_expectations.py')
155 155
156 def testConfigFile(self): 156 def testConfigFile(self):
157 # Test that the config file can be parsed as JSON. 157 # Test that the config file can be parsed as JSON.
158 config = LoadJsonFile(CONFIG_JSON) 158 config = LoadJsonFile(CONFIG_JSON)
159 # Require the following keys. 159 # Require the following keys.
160 if 'base_url' not in config: 160 if 'base_url' not in config:
161 raise Exception('base_url not specified in config file') 161 raise Exception('base_url not specified in config file')
162 if 'perf_file' not in config: 162 if 'perf_file' not in config:
163 raise Exception('perf_file not specified in config file') 163 raise Exception('perf_file not specified in config file')
164 164
165 165
166 if __name__ == '__main__': 166 if __name__ == '__main__':
167 unittest.main() 167 unittest.main()
OLDNEW
« no previous file with comments | « tools/perf_expectations/perf_expectations.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698