Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2273)

Unified Diff: Tools/Scripts/webkitpy/bindings/main.py

Issue 169743005: Faster run-bindings-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed obsolete method Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/bindings/main.py
diff --git a/Tools/Scripts/webkitpy/bindings/main.py b/Tools/Scripts/webkitpy/bindings/main.py
index a931bdd4fd9f73c256635543d218c45e68bd68bf..e438cecc9cab712dcd913ffc1cfae76fc7d13b3c 100644
--- a/Tools/Scripts/webkitpy/bindings/main.py
+++ b/Tools/Scripts/webkitpy/bindings/main.py
@@ -24,14 +24,26 @@
import fnmatch
import os
-import cPickle as pickle
import shutil
+import sys
import tempfile
from webkitpy.common.checkout.scm.detection import detect_scm_system
from webkitpy.common.system import executive
from webkitpy.common.system.executive import ScriptError
+# Add Source path to PYTHONPATH to support function calls to bindings/scripts
+# for compute_dependencies and idl_compiler
+module_path = os.path.dirname(__file__)
+source_path = os.path.normpath(os.path.join(module_path, os.pardir,
+ os.pardir, os.pardir, os.pardir,
+ 'Source'))
+sys.path.append(source_path)
+
+from bindings.scripts.compute_interfaces_info import compute
Nils Barth (inactive) 2014/03/14 01:01:37 Here you can also import |interfaces_info| ...to a
terry 2014/03/14 16:12:54 Done. On 2014/03/14 01:01:37, Nils Barth wrote:
+from bindings.scripts.idl_compiler import IdlCompilerV8
+
+
PASS_MESSAGE = 'All tests PASS!'
FAIL_MESSAGE = """Some tests FAIL!
To update the reference files, execute:
@@ -54,6 +66,9 @@ DEPENDENCY_IDL_FILES = set([
'TestPartialInterfacePython2.idl',
])
+
+EXTENDED_ATTRIBUTES_FILE = 'bindings/IDLExtendedAttributes.txt'
+
all_input_directory = '.' # Relative to Source/
test_input_directory = os.path.join('bindings', 'tests', 'idls')
reference_directory = os.path.join('bindings', 'tests', 'results')
@@ -96,6 +111,7 @@ class BindingsTests(object):
self.verbose = verbose
self.executive = executive.Executive()
self.provider = provider
+ self.idl_compiler = None
_, self.interfaces_info_filename = provider.new_temp_file()
# Generate output into the reference directory if resetting results, or
# a temp directory if not.
@@ -110,18 +126,14 @@ class BindingsTests(object):
print output
def generate_from_idl(self, idl_file):
- cmd = ['python',
- 'bindings/scripts/idl_compiler.py',
- '--output-dir', self.output_directory,
- '--idl-attributes-file', 'bindings/IDLExtendedAttributes.txt',
- '--interfaces-info-file', self.interfaces_info_filename,
- idl_file]
try:
- self.run_command(cmd)
+ idl_file_fullpath = os.path.realpath(idl_file)
+ self.idl_compiler.compile_file(idl_file_fullpath)
except ScriptError, e:
print 'ERROR: idl_compiler.py: ' + os.path.basename(idl_file)
print e.output
return e.exit_code
+
return 0
def generate_interface_dependencies(self):
@@ -145,12 +157,7 @@ class BindingsTests(object):
return list_filename
def compute_interfaces_info(idl_files_list_filename):
- cmd = ['python',
- 'bindings/scripts/compute_interfaces_info.py',
- '--idl-files-list', idl_files_list_filename,
- '--interfaces-info-file', self.interfaces_info_filename,
- '--write-file-only-if-changed', '0']
- self.run_command(cmd)
+ compute(idl_files_list_filename, self.interfaces_info_filename, False)
Nils Barth (inactive) 2014/03/14 01:01:37 Instead of using an intermediate file, we can just
terry 2014/03/14 16:12:54 Right, with the compiler taking interface_info I'l
# We compute interfaces info for *all* IDL files, not just test IDL
# files, as code generator output depends on inheritance (both ancestor
@@ -162,13 +169,13 @@ class BindingsTests(object):
# since this is also special-cased and Node inherits from EventTarget,
# but this inheritance information requires computing dependencies for
# the real Node.idl file.
- all_idl_files_list_filename = write_list_file(idl_paths_recursive(all_input_directory))
try:
- compute_interfaces_info(all_idl_files_list_filename)
+ compute_interfaces_info(idl_paths_recursive(all_input_directory))
except ScriptError, e:
print 'ERROR: compute_interfaces_info.py'
print e.output
return e.exit_code
+
return 0
def delete_cache_files(self):
@@ -226,6 +233,11 @@ class BindingsTests(object):
if self.generate_interface_dependencies():
return False
+ self.idl_compiler = IdlCompilerV8(self.output_directory,
+ EXTENDED_ATTRIBUTES_FILE,
+ interfaces_info_filename=self.interfaces_info_filename,
Nils Barth (inactive) 2014/03/14 01:01:37 We can pass the dict in directly (no file needed!)
terry 2014/03/14 16:12:54 Good idea. I didn't noticed you had added that in
+ only_if_changed=True)
+
for input_filename in os.listdir(test_input_directory):
if not input_filename.endswith('.idl'):
continue

Powered by Google App Engine
This is Rietveld 408576698