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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 for filename in fnmatch.filter(files, '*.idl')) | 155 for filename in fnmatch.filter(files, '*.idl')) |
156 return idl_paths | 156 return idl_paths |
157 | 157 |
158 def write_list_file(idl_paths): | 158 def write_list_file(idl_paths): |
159 list_file, list_filename = provider.newtempfile() | 159 list_file, list_filename = provider.newtempfile() |
160 list_contents = ''.join(idl_path + '\n' | 160 list_contents = ''.join(idl_path + '\n' |
161 for idl_path in idl_paths) | 161 for idl_path in idl_paths) |
162 os.write(list_file, list_contents) | 162 os.write(list_file, list_contents) |
163 return list_filename | 163 return list_filename |
164 | 164 |
165 def compute_dependencies(idl_files_list_filename, | 165 def compute_interfaces_info(idl_files_list_filename, |
166 event_names_filename): | 166 event_names_filename): |
167 # Dummy files, required by compute_dependencies but not checked | 167 # Dummy files, required by compute_interfaces_info but not checked |
168 _, window_constructors_file = provider.newtempfile() | 168 _, window_constructors_file = provider.newtempfile() |
169 _, workerglobalscope_constructors_file = provider.newtempfile() | 169 _, workerglobalscope_constructors_file = provider.newtempfile() |
170 _, sharedworkerglobalscope_constructors_file = provider.newtempfile(
) | 170 _, sharedworkerglobalscope_constructors_file = provider.newtempfile(
) |
171 _, dedicatedworkerglobalscope_constructors_file = provider.newtempfi
le() | 171 _, dedicatedworkerglobalscope_constructors_file = provider.newtempfi
le() |
172 _, serviceworkersglobalscope_constructors_file = provider.newtempfil
e() | 172 _, serviceworkersglobalscope_constructors_file = provider.newtempfil
e() |
173 cmd = ['python', | 173 cmd = ['python', |
174 'bindings/scripts/compute_dependencies.py', | 174 'bindings/scripts/compute_interfaces_info.py', |
175 '--idl-files-list', idl_files_list_filename, | 175 '--idl-files-list', idl_files_list_filename, |
176 '--interface-dependencies-file', self.interface_dependencies_
filename, | 176 '--interface-dependencies-file', self.interface_dependencies_
filename, |
177 '--interfaces-info-file', self.interfaces_info_filename, | 177 '--interfaces-info-file', self.interfaces_info_filename, |
178 '--window-constructors-file', window_constructors_file, | 178 '--window-constructors-file', window_constructors_file, |
179 '--workerglobalscope-constructors-file', workerglobalscope_co
nstructors_file, | 179 '--workerglobalscope-constructors-file', workerglobalscope_co
nstructors_file, |
180 '--sharedworkerglobalscope-constructors-file', sharedworkergl
obalscope_constructors_file, | 180 '--sharedworkerglobalscope-constructors-file', sharedworkergl
obalscope_constructors_file, |
181 '--dedicatedworkerglobalscope-constructors-file', dedicatedwo
rkerglobalscope_constructors_file, | 181 '--dedicatedworkerglobalscope-constructors-file', dedicatedwo
rkerglobalscope_constructors_file, |
182 '--serviceworkerglobalscope-constructors-file', serviceworker
sglobalscope_constructors_file, | 182 '--serviceworkerglobalscope-constructors-file', serviceworker
sglobalscope_constructors_file, |
183 '--event-names-file', event_names_filename, | 183 '--event-names-file', event_names_filename, |
184 '--write-file-only-if-changed', '0'] | 184 '--write-file-only-if-changed', '0'] |
185 self.run_command(cmd) | 185 self.run_command(cmd) |
186 | 186 |
187 test_idl_files_list_filename = write_list_file(idl_paths(test_input_dire
ctory)) | 187 test_idl_files_list_filename = write_list_file(idl_paths(test_input_dire
ctory)) |
188 all_idl_files_list_filename = write_list_file(idl_paths_recursive(all_in
put_directory)) | 188 all_idl_files_list_filename = write_list_file(idl_paths_recursive(all_in
put_directory)) |
189 | 189 |
190 if self.reset_results and self.verbose: | 190 if self.reset_results and self.verbose: |
191 print 'Reset results: EventInterfaces.in' | 191 print 'Reset results: EventInterfaces.in' |
192 try: | 192 try: |
193 # We first compute dependencies for testing files only, | 193 # We first compute interfaces info for testing files only, |
194 # so we can compare EventInterfaces.in. | 194 # so we can compare EventInterfaces.in. |
195 compute_dependencies(test_idl_files_list_filename, | 195 compute_interfaces_info(test_idl_files_list_filename, |
196 self.event_names_filename) | 196 self.event_names_filename) |
197 | 197 |
198 # We then compute dependencies for all IDL files, as code generator | 198 # We then compute interfaces info for all IDL files, as code |
199 # output depends on inheritance (both ancestor chain and inherited | 199 # generator output depends on inheritance (both ancestor chain and |
200 # extended attributes), and some real interfaces are special-cased, | 200 # inherited extended attributes), and some real interfaces are |
201 # such as Node. | 201 # special-cased, such as Node. |
202 # For example, when testing the behavior of interfaces that inherit | 202 # For example, when testing the behavior of interfaces that inherit |
203 # from Node, we also need to know that these inherit from | 203 # from Node, we also need to know that these inherit from |
204 # EventTarget, since this is also special-cased and Node inherits | 204 # EventTarget, since this is also special-cased and Node inherits |
205 # from EventTarget, but this inheritance information requires | 205 # from EventTarget, but this inheritance information requires |
206 # computing dependencies for the real Node.idl file. | 206 # computing dependencies for the real Node.idl file. |
207 # | 207 # |
208 # Don't overwrite the event names file generated for testing IDLs | 208 # Don't overwrite the event names file generated for testing IDLs |
209 _, dummy_event_names_filename = provider.newtempfile() | 209 _, dummy_event_names_filename = provider.newtempfile() |
210 compute_dependencies(all_idl_files_list_filename, | 210 compute_interfaces_info(all_idl_files_list_filename, |
211 dummy_event_names_filename) | 211 dummy_event_names_filename) |
212 except ScriptError, e: | 212 except ScriptError, e: |
213 print 'ERROR: compute_dependencies.py' | 213 print 'ERROR: compute_interfaces_info.py' |
214 print e.output | 214 print e.output |
215 return e.exit_code | 215 return e.exit_code |
216 return 0 | 216 return 0 |
217 | 217 |
218 def identical_file(self, reference_filename, output_filename): | 218 def identical_file(self, reference_filename, output_filename): |
219 reference_basename = os.path.basename(reference_filename) | 219 reference_basename = os.path.basename(reference_filename) |
220 cmd = ['diff', | 220 cmd = ['diff', |
221 '-u', | 221 '-u', |
222 '-N', | 222 '-N', |
223 reference_filename, | 223 reference_filename, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 all_tests_passed = self.run_tests() | 304 all_tests_passed = self.run_tests() |
305 if all_tests_passed: | 305 if all_tests_passed: |
306 if self.verbose: | 306 if self.verbose: |
307 print | 307 print |
308 print PASS_MESSAGE | 308 print PASS_MESSAGE |
309 return 0 | 309 return 0 |
310 print | 310 print |
311 print FAIL_MESSAGE | 311 print FAIL_MESSAGE |
312 return -1 | 312 return -1 |
OLD | NEW |