| 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 22 matching lines...) Expand all Loading... |
| 33 from webkitpy.common.system.executive import Executive | 33 from webkitpy.common.system.executive import Executive |
| 34 | 34 |
| 35 # Source/ path is needed both to find input IDL files, and to import other | 35 # Source/ path is needed both to find input IDL files, and to import other |
| 36 # Python modules. | 36 # Python modules. |
| 37 module_path = os.path.dirname(__file__) | 37 module_path = os.path.dirname(__file__) |
| 38 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, | 38 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir, |
| 39 os.pardir, os.pardir, 'Source')) | 39 os.pardir, os.pardir, 'Source')) |
| 40 bindings_script_path = os.path.join(source_path, 'bindings', 'scripts') | 40 bindings_script_path = os.path.join(source_path, 'bindings', 'scripts') |
| 41 sys.path.append(bindings_script_path) # for Source/bindings imports | 41 sys.path.append(bindings_script_path) # for Source/bindings imports |
| 42 | 42 |
| 43 from code_generator_v8 import CodeGeneratorUnionType, CodeGeneratorCallbackFunct
ion | 43 from code_generator_v8 import CodeGeneratorDictionaryImpl |
| 44 from code_generator_v8 import CodeGeneratorV8 |
| 45 from code_generator_v8 import CodeGeneratorUnionType |
| 46 from code_generator_v8 import CodeGeneratorCallbackFunction |
| 44 from compute_interfaces_info_individual import InterfaceInfoCollector | 47 from compute_interfaces_info_individual import InterfaceInfoCollector |
| 45 from compute_interfaces_info_overall import compute_interfaces_info_overall, int
erfaces_info | 48 from compute_interfaces_info_overall import compute_interfaces_info_overall, int
erfaces_info |
| 46 from idl_compiler import IdlCompilerDictionaryImpl, IdlCompilerV8 | 49 from idl_compiler import IdlCompiler |
| 47 from utilities import ComponentInfoProviderCore | 50 from utilities import ComponentInfoProviderCore |
| 48 from utilities import ComponentInfoProviderModules | 51 from utilities import ComponentInfoProviderModules |
| 49 from utilities import write_file | 52 from utilities import write_file |
| 50 | 53 |
| 51 | 54 |
| 52 PASS_MESSAGE = 'All tests PASS!' | 55 PASS_MESSAGE = 'All tests PASS!' |
| 53 FAIL_MESSAGE = """Some tests FAIL! | 56 FAIL_MESSAGE = """Some tests FAIL! |
| 54 To update the reference files, execute: | 57 To update the reference files, execute: |
| 55 run-bindings-tests --reset-results | 58 run-bindings-tests --reset-results |
| 56 | 59 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 try: | 290 try: |
| 288 generate_interface_dependencies() | 291 generate_interface_dependencies() |
| 289 for component in COMPONENT_DIRECTORY: | 292 for component in COMPONENT_DIRECTORY: |
| 290 output_dir = os.path.join(output_directory, component) | 293 output_dir = os.path.join(output_directory, component) |
| 291 if not os.path.exists(output_dir): | 294 if not os.path.exists(output_dir): |
| 292 os.makedirs(output_dir) | 295 os.makedirs(output_dir) |
| 293 | 296 |
| 294 generate_union_type_containers(output_dir, component) | 297 generate_union_type_containers(output_dir, component) |
| 295 generate_callback_function_impl(output_dir, component) | 298 generate_callback_function_impl(output_dir, component) |
| 296 | 299 |
| 297 idl_compiler = IdlCompilerV8( | 300 idl_compiler = IdlCompiler( |
| 298 output_dir, | 301 output_directory=output_dir, |
| 302 code_generator_class=CodeGeneratorV8, |
| 299 info_provider=component_info_providers[component], | 303 info_provider=component_info_providers[component], |
| 300 target_component=component) | 304 target_component=component) |
| 301 if component == 'core': | 305 if component == 'core': |
| 302 partial_interface_output_dir = os.path.join(output_directory, | 306 partial_interface_output_dir = os.path.join(output_directory, |
| 303 'modules') | 307 'modules') |
| 304 if not os.path.exists(partial_interface_output_dir): | 308 if not os.path.exists(partial_interface_output_dir): |
| 305 os.makedirs(partial_interface_output_dir) | 309 os.makedirs(partial_interface_output_dir) |
| 306 idl_partial_interface_compiler = IdlCompilerV8( | 310 idl_partial_interface_compiler = IdlCompiler( |
| 307 partial_interface_output_dir, | 311 output_directory=partial_interface_output_dir, |
| 312 code_generator_class=CodeGeneratorV8, |
| 308 info_provider=component_info_providers['modules'], | 313 info_provider=component_info_providers['modules'], |
| 309 target_component='modules') | 314 target_component='modules') |
| 310 else: | 315 else: |
| 311 idl_partial_interface_compiler = None | 316 idl_partial_interface_compiler = None |
| 312 | 317 |
| 313 dictionary_impl_compiler = IdlCompilerDictionaryImpl( | 318 dictionary_impl_compiler = IdlCompiler( |
| 314 output_dir, info_provider=component_info_providers[component], | 319 output_directory=output_dir, |
| 320 info_provider=component_info_providers[component], |
| 321 code_generator_class=CodeGeneratorDictionaryImpl, |
| 315 target_component=component) | 322 target_component=component) |
| 316 | 323 |
| 317 idl_filenames = [] | 324 idl_filenames = [] |
| 318 input_directory = os.path.join(test_input_directory, component) | 325 input_directory = os.path.join(test_input_directory, component) |
| 319 for filename in os.listdir(input_directory): | 326 for filename in os.listdir(input_directory): |
| 320 if (filename.endswith('.idl') and | 327 if (filename.endswith('.idl') and |
| 321 # Dependencies aren't built | 328 # Dependencies aren't built |
| 322 # (they are used by the dependent) | 329 # (they are used by the dependent) |
| 323 filename not in DEPENDENCY_IDL_FILES): | 330 filename not in DEPENDENCY_IDL_FILES): |
| 324 idl_filenames.append( | 331 idl_filenames.append( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 355 | 362 |
| 356 | 363 |
| 357 def run_bindings_tests(reset_results, verbose): | 364 def run_bindings_tests(reset_results, verbose): |
| 358 # Generate output into the reference directory if resetting results, or | 365 # Generate output into the reference directory if resetting results, or |
| 359 # a temp directory if not. | 366 # a temp directory if not. |
| 360 if reset_results: | 367 if reset_results: |
| 361 print 'Resetting results' | 368 print 'Resetting results' |
| 362 return bindings_tests(reference_directory, verbose) | 369 return bindings_tests(reference_directory, verbose) |
| 363 with TemporaryDirectory() as temp_dir: | 370 with TemporaryDirectory() as temp_dir: |
| 364 return bindings_tests(temp_dir, verbose) | 371 return bindings_tests(temp_dir, verbose) |
| OLD | NEW |