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 25 matching lines...) Expand all Loading... |
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, 'engine')) | 39 os.pardir, os.pardir, 'engine')) |
40 sys.path.append(source_path) # for engine/bindings imports | 40 sys.path.append(source_path) # for engine/bindings imports |
41 | 41 |
42 import bindings.scripts.compute_interfaces_info_individual | 42 import bindings.scripts.compute_interfaces_info_individual |
43 from bindings.scripts.compute_interfaces_info_individual import compute_info_ind
ividual, info_individual | 43 from bindings.scripts.compute_interfaces_info_individual import compute_info_ind
ividual, info_individual |
44 import bindings.scripts.compute_interfaces_info_overall | 44 import bindings.scripts.compute_interfaces_info_overall |
45 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info | 45 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info |
46 from bindings.scripts.idl_compiler import IdlCompilerDictionaryImpl, IdlCompiler
V8 | 46 from bindings.scripts.idl_compiler import IdlCompilerV8 |
47 | 47 |
48 | 48 |
49 PASS_MESSAGE = 'All tests PASS!' | 49 PASS_MESSAGE = 'All tests PASS!' |
50 FAIL_MESSAGE = """Some tests FAIL! | 50 FAIL_MESSAGE = """Some tests FAIL! |
51 To update the reference files, execute: | 51 To update the reference files, execute: |
52 run-bindings-tests --reset-results | 52 run-bindings-tests --reset-results |
53 | 53 |
54 If the failures are not due to your changes, test results may be out of sync; | 54 If the failures are not due to your changes, test results may be out of sync; |
55 please rebaseline them in a separate CL, after checking that tests fail in ToT. | 55 please rebaseline them in a separate CL, after checking that tests fail in ToT. |
56 In CL, please set: | 56 In CL, please set: |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 '(probably cruft from renaming or deleting):\n' + | 185 '(probably cruft from renaming or deleting):\n' + |
186 '\n'.join(excess_files)) | 186 '\n'.join(excess_files)) |
187 return False | 187 return False |
188 return True | 188 return True |
189 | 189 |
190 try: | 190 try: |
191 generate_interface_dependencies() | 191 generate_interface_dependencies() |
192 idl_compiler = IdlCompilerV8(output_directory, | 192 idl_compiler = IdlCompilerV8(output_directory, |
193 interfaces_info=interfaces_info, | 193 interfaces_info=interfaces_info, |
194 only_if_changed=True) | 194 only_if_changed=True) |
195 dictionary_impl_compiler = IdlCompilerDictionaryImpl( | |
196 output_directory, interfaces_info=interfaces_info, | |
197 only_if_changed=True) | |
198 | 195 |
199 idl_basenames = [filename | 196 idl_basenames = [filename |
200 for filename in os.listdir(test_input_directory) | 197 for filename in os.listdir(test_input_directory) |
201 if (filename.endswith('.idl') and | 198 if (filename.endswith('.idl') and |
202 # Dependencies aren't built | 199 # Dependencies aren't built |
203 # (they are used by the dependent) | 200 # (they are used by the dependent) |
204 filename not in DEPENDENCY_IDL_FILES)] | 201 filename not in DEPENDENCY_IDL_FILES)] |
205 for idl_basename in idl_basenames: | 202 for idl_basename in idl_basenames: |
206 idl_path = os.path.realpath( | 203 idl_path = os.path.realpath( |
207 os.path.join(test_input_directory, idl_basename)) | 204 os.path.join(test_input_directory, idl_basename)) |
208 idl_compiler.compile_file(idl_path) | 205 idl_compiler.compile_file(idl_path) |
209 definition_name, _ = os.path.splitext(idl_basename) | 206 definition_name, _ = os.path.splitext(idl_basename) |
210 if (definition_name in interfaces_info and | |
211 interfaces_info[definition_name]['is_dictionary']): | |
212 dictionary_impl_compiler.compile_file(idl_path) | |
213 if verbose: | 207 if verbose: |
214 print 'Compiled: %s' % filename | 208 print 'Compiled: %s' % filename |
215 finally: | 209 finally: |
216 delete_cache_files() | 210 delete_cache_files() |
217 | 211 |
218 # Detect all changes | 212 # Detect all changes |
219 passed = identical_output_files() | 213 passed = identical_output_files() |
220 passed &= no_excess_files() | 214 passed &= no_excess_files() |
221 | 215 |
222 if passed: | 216 if passed: |
223 if verbose: | 217 if verbose: |
224 print | 218 print |
225 print PASS_MESSAGE | 219 print PASS_MESSAGE |
226 return 0 | 220 return 0 |
227 print | 221 print |
228 print FAIL_MESSAGE | 222 print FAIL_MESSAGE |
229 return 1 | 223 return 1 |
230 | 224 |
231 | 225 |
232 def run_bindings_tests(reset_results, verbose): | 226 def run_bindings_tests(reset_results, verbose): |
233 # Generate output into the reference directory if resetting results, or | 227 # Generate output into the reference directory if resetting results, or |
234 # a temp directory if not. | 228 # a temp directory if not. |
235 if reset_results: | 229 if reset_results: |
236 print 'Resetting results' | 230 print 'Resetting results' |
237 return bindings_tests(reference_directory, verbose) | 231 return bindings_tests(reference_directory, verbose) |
238 with TemporaryDirectory() as temp_dir: | 232 with TemporaryDirectory() as temp_dir: |
239 return bindings_tests(temp_dir, verbose) | 233 return bindings_tests(temp_dir, verbose) |
OLD | NEW |