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