OLD | NEW |
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
5 # are met: | 5 # are met: |
6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
(...skipping 27 matching lines...) Expand all Loading... |
38 module_path = os.path.dirname(__file__) | 38 module_path = os.path.dirname(__file__) |
39 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, | 39 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, |
40 os.pardir, os.pardir, 'Source')) | 40 os.pardir, os.pardir, 'Source')) |
41 sys.path.append(source_path) # for Source/bindings imports | 41 sys.path.append(source_path) # for Source/bindings imports |
42 | 42 |
43 import bindings.scripts.compute_interfaces_info_individual | 43 import bindings.scripts.compute_interfaces_info_individual |
44 from bindings.scripts.compute_interfaces_info_individual import compute_info_ind
ividual, info_individual | 44 from bindings.scripts.compute_interfaces_info_individual import compute_info_ind
ividual, info_individual |
45 import bindings.scripts.compute_interfaces_info_overall | 45 import bindings.scripts.compute_interfaces_info_overall |
46 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info | 46 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info |
47 from bindings.scripts.idl_compiler import IdlCompilerDictionaryImpl, IdlCompiler
V8 | 47 from bindings.scripts.idl_compiler import IdlCompilerDictionaryImpl, IdlCompiler
V8 |
| 48 from bindings.scripts.utilities import idl_filename_to_component |
48 | 49 |
49 | 50 |
50 PASS_MESSAGE = 'All tests PASS!' | 51 PASS_MESSAGE = 'All tests PASS!' |
51 FAIL_MESSAGE = """Some tests FAIL! | 52 FAIL_MESSAGE = """Some tests FAIL! |
52 To update the reference files, execute: | 53 To update the reference files, execute: |
53 run-bindings-tests --reset-results | 54 run-bindings-tests --reset-results |
54 | 55 |
55 If the failures are not due to your changes, test results may be out of sync; | 56 If the failures are not due to your changes, test results may be out of sync; |
56 please rebaseline them in a separate CL, after checking that tests fail in ToT. | 57 please rebaseline them in a separate CL, after checking that tests fail in ToT. |
57 In CL, please set: | 58 In CL, please set: |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 try: | 225 try: |
225 generate_interface_dependencies() | 226 generate_interface_dependencies() |
226 for component in COMPONENT_DIRECTORY: | 227 for component in COMPONENT_DIRECTORY: |
227 output_dir = os.path.join(output_directory, component) | 228 output_dir = os.path.join(output_directory, component) |
228 if not os.path.exists(output_dir): | 229 if not os.path.exists(output_dir): |
229 os.makedirs(output_dir) | 230 os.makedirs(output_dir) |
230 | 231 |
231 idl_compiler = IdlCompilerV8(output_dir, | 232 idl_compiler = IdlCompilerV8(output_dir, |
232 interfaces_info=interfaces_info, | 233 interfaces_info=interfaces_info, |
233 only_if_changed=True) | 234 only_if_changed=True) |
| 235 if component == 'core': |
| 236 partial_interface_output_dir = os.path.join(output_directory, |
| 237 'modules') |
| 238 if not os.path.exists(partial_interface_output_dir): |
| 239 os.makedirs(partial_interface_output_dir) |
| 240 idl_partial_interface_compiler = IdlCompilerV8( |
| 241 partial_interface_output_dir, |
| 242 interfaces_info=interfaces_info, |
| 243 only_if_changed=True, |
| 244 target_component='modules') |
| 245 else: |
| 246 idl_partial_interface_compiler = None |
| 247 |
234 dictionary_impl_compiler = IdlCompilerDictionaryImpl( | 248 dictionary_impl_compiler = IdlCompilerDictionaryImpl( |
235 output_dir, interfaces_info=interfaces_info, | 249 output_dir, interfaces_info=interfaces_info, |
236 only_if_changed=True) | 250 only_if_changed=True) |
237 | 251 |
238 idl_filenames = [] | 252 idl_filenames = [] |
239 input_directory = os.path.join(test_input_directory, component) | 253 input_directory = os.path.join(test_input_directory, component) |
240 for filename in os.listdir(input_directory): | 254 for filename in os.listdir(input_directory): |
241 if (filename.endswith('.idl') and | 255 if (filename.endswith('.idl') and |
242 # Dependencies aren't built | 256 # Dependencies aren't built |
243 # (they are used by the dependent) | 257 # (they are used by the dependent) |
244 filename not in DEPENDENCY_IDL_FILES): | 258 filename not in DEPENDENCY_IDL_FILES): |
245 idl_filenames.append( | 259 idl_filenames.append( |
246 os.path.realpath( | 260 os.path.realpath( |
247 os.path.join(input_directory, filename))) | 261 os.path.join(input_directory, filename))) |
248 for idl_path in idl_filenames: | 262 for idl_path in idl_filenames: |
249 idl_basename = os.path.basename(idl_path) | 263 idl_basename = os.path.basename(idl_path) |
250 idl_compiler.compile_file(idl_path) | 264 idl_compiler.compile_file(idl_path) |
251 definition_name, _ = os.path.splitext(idl_basename) | 265 definition_name, _ = os.path.splitext(idl_basename) |
252 if (definition_name in interfaces_info and interfaces_info[defin
ition_name]['is_dictionary']): | 266 if definition_name in interfaces_info: |
253 dictionary_impl_compiler.compile_file(idl_path) | 267 interface_info = interfaces_info[definition_name] |
| 268 if interface_info['is_dictionary']: |
| 269 dictionary_impl_compiler.compile_file(idl_path) |
| 270 if component == 'core' and interface_info['partial_interface
_dependencies_full_paths']: |
| 271 idl_partial_interface_compiler.compile_file(idl_path) |
254 if verbose: | 272 if verbose: |
255 print 'Compiled: %s' % idl_path | 273 print 'Compiled: %s' % idl_path |
256 finally: | 274 finally: |
257 delete_cache_files() | 275 delete_cache_files() |
258 | 276 |
259 # Detect all changes | 277 # Detect all changes |
260 output_files = list_files(output_directory) | 278 output_files = list_files(output_directory) |
261 passed = identical_output_files(output_files) | 279 passed = identical_output_files(output_files) |
262 passed &= no_excess_files(output_files) | 280 passed &= no_excess_files(output_files) |
263 | 281 |
264 if passed: | 282 if passed: |
265 if verbose: | 283 if verbose: |
266 print | 284 print |
267 print PASS_MESSAGE | 285 print PASS_MESSAGE |
268 return 0 | 286 return 0 |
269 print | 287 print |
270 print FAIL_MESSAGE | 288 print FAIL_MESSAGE |
271 return 1 | 289 return 1 |
272 | 290 |
273 | 291 |
274 def run_bindings_tests(reset_results, verbose): | 292 def run_bindings_tests(reset_results, verbose): |
275 # Generate output into the reference directory if resetting results, or | 293 # Generate output into the reference directory if resetting results, or |
276 # a temp directory if not. | 294 # a temp directory if not. |
277 if reset_results: | 295 if reset_results: |
278 print 'Resetting results' | 296 print 'Resetting results' |
279 return bindings_tests(reference_directory, verbose) | 297 return bindings_tests(reference_directory, verbose) |
280 with TemporaryDirectory() as temp_dir: | 298 with TemporaryDirectory() as temp_dir: |
281 return bindings_tests(temp_dir, verbose) | 299 return bindings_tests(temp_dir, verbose) |
OLD | NEW |