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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 'Win8 Aura', | 125 'Win8 Aura', |
126 | 126 |
127 # One off builders. Note that Swarming does support ARM. | 127 # One off builders. Note that Swarming does support ARM. |
128 'Linux ARM Cross-Compile', | 128 'Linux ARM Cross-Compile', |
129 'Site Isolation Linux', | 129 'Site Isolation Linux', |
130 'Site Isolation Win', | 130 'Site Isolation Win', |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 SKIP_GN_ISOLATE_MAP_TARGETS = { | 134 SKIP_GN_ISOLATE_MAP_TARGETS = { |
135 # TODO(GYP): These targets have not been ported to GN yet. | 135 'all', |
136 'android_webview_unittests', | 136 'chromium_swarm_tests', |
137 'angle_deqp_gles2_tests', | |
138 'angle_deqp_gles3_tests', | |
139 'cast_media_unittests', | |
140 'cast_shell_browser_test', | |
141 'chromevox_tests', | |
142 'nacl_helper_nonsfi_unittests', | |
143 | |
144 # TODO(kbr): teach this script about isolated_scripts tests. | |
145 # crbug.com/620531 | |
146 'telemetry_gpu_integration_test', | |
147 'telemetry_gpu_test', | |
148 'telemetry_gpu_unittests', | |
149 'telemetry_perf_tests', | |
150 'telemetry_perf_unittests', | |
151 'telemetry_unittests', | |
152 | 137 |
153 # These tests are only run on WebRTC CI. | 138 # These tests are only run on WebRTC CI. |
154 'audio_decoder_unittests', | 139 'audio_decoder_unittests', |
155 'common_audio_unittests', | 140 'common_audio_unittests', |
156 'common_video_unittests', | 141 'common_video_unittests', |
| 142 'frame_analyzer', |
157 'modules_tests', | 143 'modules_tests', |
158 'modules_unittests', | 144 'modules_unittests', |
159 'peerconnection_unittests', | 145 'peerconnection_unittests', |
160 'rtc_media_unittests', | 146 'rtc_media_unittests', |
161 'rtc_pc_unittests', | 147 'rtc_pc_unittests', |
162 'rtc_unittests', | 148 'rtc_unittests', |
163 'system_wrappers_unittests', | 149 'system_wrappers_unittests', |
164 'test_support_unittests', | 150 'test_support_unittests', |
165 'tools_unittests', | 151 'tools_unittests', |
166 'video_engine_tests', | 152 'video_engine_tests', |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 config = json.loads(content) | 212 config = json.loads(content) |
227 except ValueError as e: | 213 except ValueError as e: |
228 raise Error('Exception raised while checking %s: %s' % (filepath, e)) | 214 raise Error('Exception raised while checking %s: %s' % (filepath, e)) |
229 | 215 |
230 for builder, data in sorted(config.iteritems()): | 216 for builder, data in sorted(config.iteritems()): |
231 if builder in SKIP: | 217 if builder in SKIP: |
232 # Oddities. | 218 # Oddities. |
233 continue | 219 continue |
234 if not isinstance(data, dict): | 220 if not isinstance(data, dict): |
235 raise Error('%s: %s is broken: %s' % (filename, builder, data)) | 221 raise Error('%s: %s is broken: %s' % (filename, builder, data)) |
236 if 'gtest_tests' not in data: | 222 if ('gtest_tests' not in data and |
| 223 'isolated_scripts' not in data and |
| 224 'additional_compile_targets' not in data): |
237 continue | 225 continue |
238 if not isinstance(data['gtest_tests'], list): | 226 |
| 227 for target in data.get('additional_compile_targets', []): |
| 228 if (target not in ninja_targets and |
| 229 target not in SKIP_GN_ISOLATE_MAP_TARGETS): |
| 230 raise Error('%s: %s / %s is not listed in gn_isolate_map.pyl' % |
| 231 (filename, builder, target)) |
| 232 elif target in ninja_targets: |
| 233 ninja_targets_seen.add(target) |
| 234 |
| 235 gtest_tests = data.get('gtest_tests', []) |
| 236 if not isinstance(gtest_tests, list): |
239 raise Error( | 237 raise Error( |
240 '%s: %s is broken: %s' % (filename, builder, data['gtest_tests'])) | 238 '%s: %s is broken: %s' % (filename, builder, gtest_tests)) |
241 if not all(isinstance(g, dict) for g in data['gtest_tests']): | 239 if not all(isinstance(g, dict) for g in gtest_tests): |
242 raise Error( | 240 raise Error( |
243 '%s: %s is broken: %s' % (filename, builder, data['gtest_tests'])) | 241 '%s: %s is broken: %s' % (filename, builder, gtest_tests)) |
244 | 242 |
245 seen = set() | 243 seen = set() |
246 for d in data['gtest_tests']: | 244 for d in gtest_tests: |
247 if (d['test'] not in ninja_targets and | 245 test = d['test'] |
248 d['test'] not in SKIP_GN_ISOLATE_MAP_TARGETS): | 246 if (test not in ninja_targets and |
| 247 test not in SKIP_GN_ISOLATE_MAP_TARGETS): |
249 raise Error('%s: %s / %s is not listed in gn_isolate_map.pyl.' % | 248 raise Error('%s: %s / %s is not listed in gn_isolate_map.pyl.' % |
250 (filename, builder, d['test'])) | 249 (filename, builder, test)) |
251 elif d['test'] in ninja_targets: | 250 elif test in ninja_targets: |
252 ninja_targets_seen.add(d['test']) | 251 ninja_targets_seen.add(test) |
253 | 252 |
254 name = d.get('name', d['test']) | 253 name = d.get('name', d['test']) |
255 if name in seen: | 254 if name in seen: |
256 raise Error('%s: %s / %s is listed multiple times.' % | 255 raise Error('%s: %s / %s is listed multiple times.' % |
257 (filename, builder, name)) | 256 (filename, builder, name)) |
258 seen.add(name) | 257 seen.add(name) |
259 d.setdefault('swarming', {}).setdefault( | 258 d.setdefault('swarming', {}).setdefault( |
260 'can_use_on_swarming_builders', False) | 259 'can_use_on_swarming_builders', False) |
261 | 260 |
262 config[builder]['gtest_tests'] = sorted( | 261 if gtest_tests: |
263 data['gtest_tests'], key=lambda x: x['test']) | 262 config[builder]['gtest_tests'] = sorted( |
| 263 gtest_tests, key=lambda x: x['test']) |
| 264 |
| 265 for d in data.get('isolated_scripts', []): |
| 266 name = d['isolate_name'] |
| 267 if (name not in ninja_targets and |
| 268 name not in SKIP_GN_ISOLATE_MAP_TARGETS): |
| 269 raise Error('%s: %s / %s is not listed in gn_isolate_map.pyl.' % |
| 270 (filename, builder, name)) |
| 271 elif name in ninja_targets: |
| 272 ninja_targets_seen.add(name) |
264 | 273 |
265 # The trick here is that process_builder_remaining() is called before | 274 # The trick here is that process_builder_remaining() is called before |
266 # process_builder_convert() so tests_location can be used to know how many | 275 # process_builder_convert() so tests_location can be used to know how many |
267 # tests were converted. | 276 # tests were converted. |
268 if mode in ('convert', 'remaining'): | 277 if mode in ('convert', 'remaining'): |
269 process_builder_remaining(data, filename, builder, tests_location) | 278 process_builder_remaining(data, filename, builder, tests_location) |
270 if mode == 'convert': | 279 if mode == 'convert': |
271 process_builder_convert(data, test_name) | 280 process_builder_convert(data, test_name) |
272 | 281 |
273 expected = json.dumps( | 282 expected = json.dumps( |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 elif args.mode == 'remaining': | 420 elif args.mode == 'remaining': |
412 print_remaining(args.test_name, tests_location) | 421 print_remaining(args.test_name, tests_location) |
413 return result | 422 return result |
414 except Error as e: | 423 except Error as e: |
415 sys.stderr.write('%s\n' % e) | 424 sys.stderr.write('%s\n' % e) |
416 return 1 | 425 return 1 |
417 | 426 |
418 | 427 |
419 if __name__ == "__main__": | 428 if __name__ == "__main__": |
420 sys.exit(main()) | 429 sys.exit(main()) |
OLD | NEW |