| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Verify perf_expectations.json can be loaded using simplejson. | 7 """Verify perf_expectations.json can be loaded using simplejson. |
| 8 | 8 |
| 9 perf_expectations.json is a JSON-formatted file. This script verifies | 9 perf_expectations.json is a JSON-formatted file. This script verifies |
| 10 that simplejson can load it correctly. It should catch most common | 10 that simplejson can load it correctly. It should catch most common |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 not isinstance(perf_data[key]['var'], float)): | 114 not isinstance(perf_data[key]['var'], float)): |
| 115 bad_keys.append(key) | 115 bad_keys.append(key) |
| 116 if len(bad_keys) > 0: | 116 if len(bad_keys) > 0: |
| 117 msg = "perf expectations key values missing or invalid delta/var" | 117 msg = "perf expectations key values missing or invalid delta/var" |
| 118 raise Exception("%s: %s" % (msg, bad_keys)) | 118 raise Exception("%s: %s" % (msg, bad_keys)) |
| 119 | 119 |
| 120 # Test all keys have the correct format. | 120 # Test all keys have the correct format. |
| 121 for key in perf_data: | 121 for key in perf_data: |
| 122 if key == 'load': | 122 if key == 'load': |
| 123 continue | 123 continue |
| 124 # tools/buildbot/scripts/master/log_parser.py should have a matching |
| 125 # regular expression. |
| 124 if not re.match(r"^([\w\.-]+)/([\w\.-]+)/([\w\.-]+)/([\w\.-]+)$", key): | 126 if not re.match(r"^([\w\.-]+)/([\w\.-]+)/([\w\.-]+)/([\w\.-]+)$", key): |
| 125 bad_keys.append(key) | 127 bad_keys.append(key) |
| 126 if len(bad_keys) > 0: | 128 if len(bad_keys) > 0: |
| 127 msg = "perf expectations keys in bad format, expected a/b/c/d" | 129 msg = "perf expectations keys in bad format, expected a/b/c/d" |
| 128 raise Exception("%s: %s" % (msg, bad_keys)) | 130 raise Exception("%s: %s" % (msg, bad_keys)) |
| 129 | 131 |
| 130 if __name__ == '__main__': | 132 if __name__ == '__main__': |
| 131 unittest.main() | 133 unittest.main() |
| OLD | NEW |