OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # 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 |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Toolbox to manage all the json files in this directory. | 6 """Toolbox to manage all the json files in this directory. |
7 | 7 |
8 It can reformat them in their canonical format or ensures they are well | 8 It can reformat them in their canonical format or ensures they are well |
9 formatted. | 9 formatted. |
10 """ | 10 """ |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 tests_location = collections.defaultdict( | 90 tests_location = collections.defaultdict( |
91 lambda: { | 91 lambda: { |
92 'count_run_local': 0, 'count_run_on_swarming': 0, 'local_configs': {} | 92 'count_run_local': 0, 'count_run_on_swarming': 0, 'local_configs': {} |
93 }) | 93 }) |
94 | 94 |
95 result = 0 | 95 result = 0 |
96 for filepath in glob.glob(os.path.join(THIS_DIR, '*.json')): | 96 for filepath in glob.glob(os.path.join(THIS_DIR, '*.json')): |
97 filename = os.path.basename(filepath) | 97 filename = os.path.basename(filepath) |
98 with open(filepath) as f: | 98 with open(filepath) as f: |
99 content = f.read() | 99 content = f.read() |
100 config = json.loads(content) | 100 try: |
| 101 config = json.loads(content) |
| 102 except ValueError as e: |
| 103 print "Exception raised while checking %s: %s" % (filepath, e) |
| 104 raise |
101 for builder, data in sorted(config.iteritems()): | 105 for builder, data in sorted(config.iteritems()): |
102 if builder in SKIP: | 106 if builder in SKIP: |
103 # Oddities. | 107 # Oddities. |
104 continue | 108 continue |
105 | 109 |
106 if not isinstance(data, dict): | 110 if not isinstance(data, dict): |
107 print('%s: %s is broken: %s' % (filename, builder, data)) | 111 print('%s: %s is broken: %s' % (filename, builder, data)) |
108 continue | 112 continue |
109 | 113 |
110 if 'gtest_tests' in data: | 114 if 'gtest_tests' in data: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 p_swarming = 100. * total_swarming / total | 184 p_swarming = 100. * total_swarming / total |
181 print('%s%-*s %4d (%4.1f%%) %4d (%4.1f%%)' % | 185 print('%s%-*s %4d (%4.1f%%) %4d (%4.1f%%)' % |
182 (colorama.Fore.WHITE, l, 'Total:', total_local, p_local, | 186 (colorama.Fore.WHITE, l, 'Total:', total_local, p_local, |
183 total_swarming, p_swarming)) | 187 total_swarming, p_swarming)) |
184 print('%-*s %4d' % (l, 'Total executions:', total)) | 188 print('%-*s %4d' % (l, 'Total executions:', total)) |
185 return result | 189 return result |
186 | 190 |
187 | 191 |
188 if __name__ == "__main__": | 192 if __name__ == "__main__": |
189 sys.exit(main()) | 193 sys.exit(main()) |
OLD | NEW |