| 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 try: | 100 config = json.loads(content) |
| 101 config = json.loads(content) | |
| 102 except ValueError as e: | |
| 103 print "Exception raised while checking %s: %s" % (filepath, e) | |
| 104 raise | |
| 105 for builder, data in sorted(config.iteritems()): | 101 for builder, data in sorted(config.iteritems()): |
| 106 if builder in SKIP: | 102 if builder in SKIP: |
| 107 # Oddities. | 103 # Oddities. |
| 108 continue | 104 continue |
| 109 | 105 |
| 110 if not isinstance(data, dict): | 106 if not isinstance(data, dict): |
| 111 print('%s: %s is broken: %s' % (filename, builder, data)) | 107 print('%s: %s is broken: %s' % (filename, builder, data)) |
| 112 continue | 108 continue |
| 113 | 109 |
| 114 if 'gtest_tests' in data: | 110 if 'gtest_tests' in data: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 p_swarming = 100. * total_swarming / total | 180 p_swarming = 100. * total_swarming / total |
| 185 print('%s%-*s %4d (%4.1f%%) %4d (%4.1f%%)' % | 181 print('%s%-*s %4d (%4.1f%%) %4d (%4.1f%%)' % |
| 186 (colorama.Fore.WHITE, l, 'Total:', total_local, p_local, | 182 (colorama.Fore.WHITE, l, 'Total:', total_local, p_local, |
| 187 total_swarming, p_swarming)) | 183 total_swarming, p_swarming)) |
| 188 print('%-*s %4d' % (l, 'Total executions:', total)) | 184 print('%-*s %4d' % (l, 'Total executions:', total)) |
| 189 return result | 185 return result |
| 190 | 186 |
| 191 | 187 |
| 192 if __name__ == "__main__": | 188 if __name__ == "__main__": |
| 193 sys.exit(main()) | 189 sys.exit(main()) |
| OLD | NEW |