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 partial_interface_output_dir = None | |
bashi
2014/10/15 05:29:23
Remove? It seems that you don't use |partial_inter
tasak
2014/10/15 11:24:19
Done.
| |
247 idl_partial_interface_compiler = None | |
bashi
2014/10/15 05:29:23
Question: Does this mean that we don't test partia
tasak
2014/10/15 11:24:19
If partial interfaces are defined in modules and t
| |
248 | |
234 dictionary_impl_compiler = IdlCompilerDictionaryImpl( | 249 dictionary_impl_compiler = IdlCompilerDictionaryImpl( |
235 output_dir, interfaces_info=interfaces_info, | 250 output_dir, interfaces_info=interfaces_info, |
236 only_if_changed=True) | 251 only_if_changed=True) |
237 | 252 |
238 idl_filenames = [] | 253 idl_filenames = [] |
239 input_directory = os.path.join(test_input_directory, component) | 254 input_directory = os.path.join(test_input_directory, component) |
240 for filename in os.listdir(input_directory): | 255 for filename in os.listdir(input_directory): |
241 if (filename.endswith('.idl') and | 256 if (filename.endswith('.idl') and |
242 # Dependencies aren't built | 257 # Dependencies aren't built |
243 # (they are used by the dependent) | 258 # (they are used by the dependent) |
244 filename not in DEPENDENCY_IDL_FILES): | 259 filename not in DEPENDENCY_IDL_FILES): |
245 idl_filenames.append( | 260 idl_filenames.append( |
246 os.path.realpath( | 261 os.path.realpath( |
247 os.path.join(input_directory, filename))) | 262 os.path.join(input_directory, filename))) |
248 for idl_path in idl_filenames: | 263 for idl_path in idl_filenames: |
249 idl_basename = os.path.basename(idl_path) | 264 idl_basename = os.path.basename(idl_path) |
250 idl_compiler.compile_file(idl_path) | 265 idl_compiler.compile_file(idl_path) |
251 definition_name, _ = os.path.splitext(idl_basename) | 266 definition_name, _ = os.path.splitext(idl_basename) |
252 if (definition_name in interfaces_info and interfaces_info[defin ition_name]['is_dictionary']): | 267 if definition_name in interfaces_info: |
253 dictionary_impl_compiler.compile_file(idl_path) | 268 interface_info = interfaces_info[definition_name] |
269 if interface_info['is_dictionary']: | |
270 dictionary_impl_compiler.compile_file(idl_path) | |
271 if component == 'core' and interface_info['partial_interface _dependencies_full_paths']: | |
272 idl_partial_interface_compiler.compile_file(idl_path) | |
254 if verbose: | 273 if verbose: |
255 print 'Compiled: %s' % idl_path | 274 print 'Compiled: %s' % idl_path |
256 finally: | 275 finally: |
257 delete_cache_files() | 276 delete_cache_files() |
258 | 277 |
259 # Detect all changes | 278 # Detect all changes |
260 output_files = list_files(output_directory) | 279 output_files = list_files(output_directory) |
261 passed = identical_output_files(output_files) | 280 passed = identical_output_files(output_files) |
262 passed &= no_excess_files(output_files) | 281 passed &= no_excess_files(output_files) |
263 | 282 |
264 if passed: | 283 if passed: |
265 if verbose: | 284 if verbose: |
266 print | 285 print |
267 print PASS_MESSAGE | 286 print PASS_MESSAGE |
268 return 0 | 287 return 0 |
269 print | 288 print |
270 print FAIL_MESSAGE | 289 print FAIL_MESSAGE |
271 return 1 | 290 return 1 |
272 | 291 |
273 | 292 |
274 def run_bindings_tests(reset_results, verbose): | 293 def run_bindings_tests(reset_results, verbose): |
275 # Generate output into the reference directory if resetting results, or | 294 # Generate output into the reference directory if resetting results, or |
276 # a temp directory if not. | 295 # a temp directory if not. |
277 if reset_results: | 296 if reset_results: |
278 print 'Resetting results' | 297 print 'Resetting results' |
279 return bindings_tests(reference_directory, verbose) | 298 return bindings_tests(reference_directory, verbose) |
280 with TemporaryDirectory() as temp_dir: | 299 with TemporaryDirectory() as temp_dir: |
281 return bindings_tests(temp_dir, verbose) | 300 return bindings_tests(temp_dir, verbose) |
OLD | NEW |