| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 from webkitpy.common.system.executive import Executive | 33 from webkitpy.common.system.executive import Executive |
| 34 | 34 |
| 35 # Source/ path is needed both to find input IDL files, and to import other | 35 # Source/ path is needed both to find input IDL files, and to import other |
| 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, 'Source')) | 39 os.pardir, os.pardir, 'Source')) |
| 40 sys.path.append(source_path) # for Source/bindings imports | 40 sys.path.append(source_path) # for Source/bindings imports |
| 41 | 41 |
| 42 from bindings.scripts.compute_interfaces_info import compute_interfaces_info, in
terfaces_info | 42 import bindings.scripts.compute_interfaces_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 |
| 45 from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_
info_overall, interfaces_info |
| 43 from bindings.scripts.idl_compiler import IdlCompilerV8 | 46 from bindings.scripts.idl_compiler import IdlCompilerV8 |
| 44 | 47 |
| 45 | 48 |
| 46 PASS_MESSAGE = 'All tests PASS!' | 49 PASS_MESSAGE = 'All tests PASS!' |
| 47 FAIL_MESSAGE = """Some tests FAIL! | 50 FAIL_MESSAGE = """Some tests FAIL! |
| 48 To update the reference files, execute: | 51 To update the reference files, execute: |
| 49 run-bindings-tests --reset-results | 52 run-bindings-tests --reset-results |
| 50 | 53 |
| 51 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; |
| 52 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. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 # We compute interfaces info for *all* IDL files, not just test IDL | 100 # We compute interfaces info for *all* IDL files, not just test IDL |
| 98 # files, as code generator output depends on inheritance (both ancestor | 101 # files, as code generator output depends on inheritance (both ancestor |
| 99 # chain and inherited extended attributes), and some real interfaces | 102 # chain and inherited extended attributes), and some real interfaces |
| 100 # are special-cased, such as Node. | 103 # are special-cased, such as Node. |
| 101 # | 104 # |
| 102 # For example, when testing the behavior of interfaces that inherit | 105 # For example, when testing the behavior of interfaces that inherit |
| 103 # from Node, we also need to know that these inherit from EventTarget, | 106 # from Node, we also need to know that these inherit from EventTarget, |
| 104 # since this is also special-cased and Node inherits from EventTarget, | 107 # since this is also special-cased and Node inherits from EventTarget, |
| 105 # but this inheritance information requires computing dependencies for | 108 # but this inheritance information requires computing dependencies for |
| 106 # the real Node.idl file. | 109 # the real Node.idl file. |
| 107 compute_interfaces_info(idl_paths_recursive(source_path)) | 110 |
| 111 # 2-stage computation: individual, then overall |
| 112 for idl_filename in idl_paths_recursive(source_path): |
| 113 compute_info_individual(idl_filename) |
| 114 info_individuals = [info_individual()] |
| 115 compute_interfaces_info_overall(info_individuals) |
| 108 | 116 |
| 109 | 117 |
| 110 def bindings_tests(output_directory, verbose): | 118 def bindings_tests(output_directory, verbose): |
| 111 executive = Executive() | 119 executive = Executive() |
| 112 | 120 |
| 113 def diff(filename1, filename2): | 121 def diff(filename1, filename2): |
| 114 # Python's difflib module is too slow, especially on long output, so | 122 # Python's difflib module is too slow, especially on long output, so |
| 115 # run external diff(1) command | 123 # run external diff(1) command |
| 116 cmd = ['diff', | 124 cmd = ['diff', |
| 117 '-u', # unified format | 125 '-u', # unified format |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 218 |
| 211 | 219 |
| 212 def run_bindings_tests(reset_results, verbose): | 220 def run_bindings_tests(reset_results, verbose): |
| 213 # Generate output into the reference directory if resetting results, or | 221 # Generate output into the reference directory if resetting results, or |
| 214 # a temp directory if not. | 222 # a temp directory if not. |
| 215 if reset_results: | 223 if reset_results: |
| 216 print 'Resetting results' | 224 print 'Resetting results' |
| 217 return bindings_tests(reference_directory, verbose) | 225 return bindings_tests(reference_directory, verbose) |
| 218 with TemporaryDirectory() as temp_dir: | 226 with TemporaryDirectory() as temp_dir: |
| 219 return bindings_tests(temp_dir, verbose) | 227 return bindings_tests(temp_dir, verbose) |
| OLD | NEW |