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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 exit_code = 0 | 54 exit_code = 0 |
55 try: | 55 try: |
56 output = self.executive.run_command(cmd) | 56 output = self.executive.run_command(cmd) |
57 if output: | 57 if output: |
58 print output | 58 print output |
59 except ScriptError, e: | 59 except ScriptError, e: |
60 print e.output | 60 print e.output |
61 exit_code = e.exit_code | 61 exit_code = e.exit_code |
62 return exit_code | 62 return exit_code |
63 | 63 |
64 def generate_supplemental_dependency(self, input_directory, supplemental_dep
endency_file, window_constructors_file, workercontext_constructors_file): | 64 def generate_supplemental_dependency(self, input_directory, supplemental_dep
endency_file, window_constructors_file, workerglobalscope_constructors_file, sha
redworkerglobalscope_constructors_file, dedicatedworkerglobalscope_constructors_
file): |
65 idl_files_list = tempfile.mkstemp() | 65 idl_files_list = tempfile.mkstemp() |
66 for input_file in os.listdir(input_directory): | 66 for input_file in os.listdir(input_directory): |
67 (name, extension) = os.path.splitext(input_file) | 67 (name, extension) = os.path.splitext(input_file) |
68 if extension != '.idl': | 68 if extension != '.idl': |
69 continue | 69 continue |
70 os.write(idl_files_list[0], os.path.join(input_directory, input_file
) + "\n") | 70 os.write(idl_files_list[0], os.path.join(input_directory, input_file
) + "\n") |
71 os.close(idl_files_list[0]) | 71 os.close(idl_files_list[0]) |
72 | 72 |
73 cmd = ['python', | 73 cmd = ['python', |
74 'bindings/scripts/preprocess_idls.py', | 74 'bindings/scripts/preprocess_idls.py', |
75 '--idl-files-list', idl_files_list[1], | 75 '--idl-files-list', idl_files_list[1], |
76 '--supplemental-dependency-file', supplemental_dependency_file, | 76 '--supplemental-dependency-file', supplemental_dependency_file, |
77 '--window-constructors-file', window_constructors_file, | 77 '--window-constructors-file', window_constructors_file, |
78 '--workercontext-constructors-file', workercontext_constructors_f
ile, | 78 '--workerglobalscope-constructors-file', workerglobalscope_constr
uctors_file, |
| 79 '--sharedworkerglobalscope-constructors-file', sharedworkerglobal
scope_constructors_file, |
| 80 '--dedicatedworkerglobalscope-constructors-file', dedicatedworker
globalscope_constructors_file, |
79 '--write-file-only-if-changed', '0'] | 81 '--write-file-only-if-changed', '0'] |
80 | 82 |
81 exit_code = 0 | 83 exit_code = 0 |
82 try: | 84 try: |
83 output = self.executive.run_command(cmd) | 85 output = self.executive.run_command(cmd) |
84 if output: | 86 if output: |
85 print output | 87 print output |
86 except ScriptError, e: | 88 except ScriptError, e: |
87 print e.output | 89 print e.output |
88 exit_code = e.exit_code | 90 exit_code = e.exit_code |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 146 |
145 def main(self): | 147 def main(self): |
146 current_scm = detect_scm_system(os.curdir) | 148 current_scm = detect_scm_system(os.curdir) |
147 os.chdir(os.path.join(current_scm.checkout_root, 'Source')) | 149 os.chdir(os.path.join(current_scm.checkout_root, 'Source')) |
148 | 150 |
149 all_tests_passed = True | 151 all_tests_passed = True |
150 | 152 |
151 input_directory = os.path.join('bindings', 'tests', 'idls') | 153 input_directory = os.path.join('bindings', 'tests', 'idls') |
152 supplemental_dependency_file = tempfile.mkstemp()[1] | 154 supplemental_dependency_file = tempfile.mkstemp()[1] |
153 window_constructors_file = tempfile.mkstemp()[1] | 155 window_constructors_file = tempfile.mkstemp()[1] |
154 workercontext_constructors_file = tempfile.mkstemp()[1] | 156 workerglobalscope_constructors_file = tempfile.mkstemp()[1] |
155 if self.generate_supplemental_dependency(input_directory, supplemental_d
ependency_file, window_constructors_file, workercontext_constructors_file): | 157 sharedworkerglobalscope_constructors_file = tempfile.mkstemp()[1] |
| 158 dedicatedworkerglobalscope_constructors_file = tempfile.mkstemp()[1] |
| 159 if self.generate_supplemental_dependency(input_directory, supplemental_d
ependency_file, window_constructors_file, workerglobalscope_constructors_file, s
haredworkerglobalscope_constructors_file, dedicatedworkerglobalscope_constructor
s_file): |
156 print 'Failed to generate a supplemental dependency file.' | 160 print 'Failed to generate a supplemental dependency file.' |
157 os.remove(supplemental_dependency_file) | 161 os.remove(supplemental_dependency_file) |
158 return -1 | 162 return -1 |
159 | 163 |
160 input_directory = os.path.join('bindings', 'tests', 'idls') | 164 input_directory = os.path.join('bindings', 'tests', 'idls') |
161 reference_directory = os.path.join('bindings', 'tests', 'results') | 165 reference_directory = os.path.join('bindings', 'tests', 'results') |
162 if not self.run_tests(input_directory, reference_directory, supplemental
_dependency_file): | 166 if not self.run_tests(input_directory, reference_directory, supplemental
_dependency_file): |
163 all_tests_passed = False | 167 all_tests_passed = False |
164 | 168 |
165 os.remove(supplemental_dependency_file) | 169 os.remove(supplemental_dependency_file) |
166 print '' | 170 print '' |
167 if all_tests_passed: | 171 if all_tests_passed: |
168 print 'All tests PASS!' | 172 print 'All tests PASS!' |
169 return 0 | 173 return 0 |
170 else: | 174 else: |
171 print 'Some tests FAIL! (To update the reference files, execute "run
-bindings-tests --reset-results")' | 175 print 'Some tests FAIL! (To update the reference files, execute "run
-bindings-tests --reset-results")' |
172 return -1 | 176 return -1 |
OLD | NEW |