Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 # These are not supported on Swarming yet. | 34 # These are not supported on Swarming yet. |
| 35 # http://crbug.com/472205 | 35 # http://crbug.com/472205 |
| 36 'Chromium Mac 10.10', | 36 'Chromium Mac 10.10', |
| 37 # http://crbug.com/441429 | 37 # http://crbug.com/441429 |
| 38 'Linux Trusty (32)', 'Linux Trusty (dbg)(32)', | 38 'Linux Trusty (32)', 'Linux Trusty (dbg)(32)', |
| 39 | 39 |
| 40 # http://crbug.com/480053 | 40 # http://crbug.com/480053 |
| 41 'Linux GN', | 41 'Linux GN', |
| 42 'Linux GN (dbg)', | 42 'Linux GN (dbg)', |
| 43 'linux_chromium_gn_rel', | |
| 44 | 43 |
| 45 # Unmaintained builders on chromium.fyi | 44 # Unmaintained builders on chromium.fyi |
| 46 'ClangToTMac', | 45 'ClangToTMac', |
| 47 'ClangToTMacASan', | 46 'ClangToTMacASan', |
| 48 | 47 |
| 49 # This builder is fine, but win8_chromium_ng uses GN and this configuration, | 48 # This builder is fine, but win8_chromium_ng uses GN and this configuration, |
| 50 # which breaks everything. | 49 # which breaks everything. |
| 51 'Win8 Aura', | 50 'Win8 Aura', |
| 52 | 51 |
| 53 # One off builders. Note that Swarming does support ARM. | 52 # One off builders. Note that Swarming does support ARM. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 if not isinstance(data['gtest_tests'], list): | 130 if not isinstance(data['gtest_tests'], list): |
| 132 raise Error( | 131 raise Error( |
| 133 '%s: %s is broken: %s' % (filename, builder, data['gtest_tests'])) | 132 '%s: %s is broken: %s' % (filename, builder, data['gtest_tests'])) |
| 134 if not all(isinstance(g, dict) for g in data['gtest_tests']): | 133 if not all(isinstance(g, dict) for g in data['gtest_tests']): |
| 135 raise Error( | 134 raise Error( |
| 136 '%s: %s is broken: %s' % (filename, builder, data['gtest_tests'])) | 135 '%s: %s is broken: %s' % (filename, builder, data['gtest_tests'])) |
| 137 | 136 |
| 138 for d in data['gtest_tests']: | 137 for d in data['gtest_tests']: |
| 139 if (d['test'] not in ninja_targets and | 138 if (d['test'] not in ninja_targets and |
| 140 d['test'] not in SKIP_NINJA_TO_GN_TARGETS): | 139 d['test'] not in SKIP_NINJA_TO_GN_TARGETS): |
| 141 raise Error('%s: %s / %s is not listed in ninja_to_gn.pyl.' % | 140 raise Error('%s: %s / %s is not listed in gn_isolate_map.pyl.' % |
| 142 (filename, builder, d['test'])) | 141 (filename, builder, d['test'])) |
| 143 elif d['test'] in ninja_targets: | 142 elif d['test'] in ninja_targets: |
| 144 ninja_targets_seen.add(d['test']) | 143 ninja_targets_seen.add(d['test']) |
| 145 | 144 |
| 146 config[builder]['gtest_tests'] = sorted( | 145 config[builder]['gtest_tests'] = sorted( |
| 147 data['gtest_tests'], key=lambda x: x['test']) | 146 data['gtest_tests'], key=lambda x: x['test']) |
| 148 | 147 |
| 149 # The trick here is that process_builder_remaining() is called before | 148 # The trick here is that process_builder_remaining() is called before |
| 150 # process_builder_convert() so tests_location can be used to know how many | 149 # process_builder_convert() so tests_location can be used to know how many |
| 151 # tests were converted. | 150 # tests were converted. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 parser.error('A test name is required with --convert') | 260 parser.error('A test name is required with --convert') |
| 262 if args.test_name + '.isolate' not in get_isolates(): | 261 if args.test_name + '.isolate' not in get_isolates(): |
| 263 parser.error('Create %s.isolate first' % args.test_name) | 262 parser.error('Create %s.isolate first' % args.test_name) |
| 264 | 263 |
| 265 # Stats when running in --remaining mode; | 264 # Stats when running in --remaining mode; |
| 266 tests_location = collections.defaultdict( | 265 tests_location = collections.defaultdict( |
| 267 lambda: { | 266 lambda: { |
| 268 'count_run_local': 0, 'count_run_on_swarming': 0, 'local_configs': {} | 267 'count_run_local': 0, 'count_run_on_swarming': 0, 'local_configs': {} |
| 269 }) | 268 }) |
| 270 | 269 |
| 271 with open(os.path.join(THIS_DIR, "ninja_to_gn.pyl")) as fp: | 270 with open(os.path.join(THIS_DIR, "gn_isolate_map.pyl")) as fp: |
| 272 ninja_targets = ast.literal_eval(fp.read()) | 271 gn_isolate_map = ast.literal_eval(fp.read()) |
| 272 ninja_targets = dict((k, v['label']) for k, v in gn_isolate_map.items()) | |
|
M-A Ruel
2015/07/22 18:22:42
Stylistically, I would have preferred:
ninja_targe
| |
| 273 | 273 |
| 274 try: | 274 try: |
| 275 result = 0 | 275 result = 0 |
| 276 ninja_targets_seen = set() | 276 ninja_targets_seen = set() |
| 277 for filepath in glob.glob(os.path.join(THIS_DIR, '*.json')): | 277 for filepath in glob.glob(os.path.join(THIS_DIR, '*.json')): |
| 278 if not process_file(args.mode, args.test_name, tests_location, filepath, | 278 if not process_file(args.mode, args.test_name, tests_location, filepath, |
| 279 ninja_targets, ninja_targets_seen): | 279 ninja_targets, ninja_targets_seen): |
| 280 result = 1 | 280 result = 1 |
| 281 | 281 |
| 282 extra_targets = set(ninja_targets) - ninja_targets_seen | 282 extra_targets = set(ninja_targets) - ninja_targets_seen |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 293 elif args.mode == 'remaining': | 293 elif args.mode == 'remaining': |
| 294 print_remaining(args.test_name, tests_location) | 294 print_remaining(args.test_name, tests_location) |
| 295 return result | 295 return result |
| 296 except Error as e: | 296 except Error as e: |
| 297 sys.stderr.write('%s\n' % e) | 297 sys.stderr.write('%s\n' % e) |
| 298 return 1 | 298 return 1 |
| 299 | 299 |
| 300 | 300 |
| 301 if __name__ == "__main__": | 301 if __name__ == "__main__": |
| 302 sys.exit(main()) | 302 sys.exit(main()) |
| OLD | NEW |