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

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: Changes from CR 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
« no previous file with comments | « Source/bindings/scripts/__init__.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ba639d75f5750d498a1bf7e7c7c27ec239856bad 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
Nils Barth (inactive) 2014/03/17 02:06:14 Could you update this to: "compute_interfaces_info
terry 2014/03/17 16:36:38 Done.
+module_path = os.path.dirname(__file__)
+source_path = os.path.normpath(os.path.join(module_path, os.pardir,
Nils Barth (inactive) 2014/03/17 02:06:14 Could you wrap the line slightly tighter? It fits
terry 2014/03/17 16:36:38 Done.
+ os.pardir, os.pardir, os.pardir,
+ 'Source'))
+sys.path.append(source_path)
+
+from bindings.scripts.compute_interfaces_info import compute_interfaces_info, interfaces_info
+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,7 +111,7 @@ class BindingsTests(object):
self.verbose = verbose
self.executive = executive.Executive()
self.provider = provider
- _, self.interfaces_info_filename = provider.new_temp_file()
+ self.idl_compiler = None
# Generate output into the reference directory if resetting results, or
# a temp directory if not.
if reset_results:
@@ -110,18 +125,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)
Nils Barth (inactive) 2014/03/17 02:06:14 Could you move this before the try statement?
terry 2014/03/17 16:36:38 Done.
+ self.idl_compiler.compile_file(idl_file_fullpath)
except ScriptError, e:
Nils Barth (inactive) 2014/03/17 02:06:14 We need to update this catch clause, since we're n
terry 2014/03/17 16:36:38 Done.
print 'ERROR: idl_compiler.py: ' + os.path.basename(idl_file)
print e.output
Nils Barth (inactive) 2014/03/17 02:06:14 This can then just be: print err
terry 2014/03/17 16:36:38 Done.
return e.exit_code
Nils Barth (inactive) 2014/03/17 02:06:14 ...and then: return 1
terry 2014/03/17 16:36:38 Done.
+
return 0
def generate_interface_dependencies(self):
@@ -144,14 +155,6 @@ class BindingsTests(object):
os.write(list_file, list_contents)
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)
-
# We compute interfaces info for *all* IDL files, not just test IDL
# files, as code generator output depends on inheritance (both ancestor
# chain and inherited extended attributes), and some real interfaces
@@ -162,13 +165,14 @@ 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:
Nils Barth (inactive) 2014/03/17 02:06:14 Could you update this catch clause as described ab
terry 2014/03/17 16:36:38 Done.
print 'ERROR: compute_interfaces_info.py'
print e.output
return e.exit_code
+
return 0
def delete_cache_files(self):
@@ -226,6 +230,11 @@ class BindingsTests(object):
if self.generate_interface_dependencies():
return False
+ self.idl_compiler = IdlCompilerV8(self.output_directory,
Nils Barth (inactive) 2014/03/17 02:06:14 Could you move this up into the __init__?
terry 2014/03/17 16:36:38 I don't think so the interfaces_info isn't compute
Nils Barth (inactive) 2014/03/18 09:23:16 Got it, thanks! (I think we could simplify r-b-t b
+ EXTENDED_ATTRIBUTES_FILE,
+ interfaces_info=interfaces_info,
+ only_if_changed=True)
+
for input_filename in os.listdir(test_input_directory):
if not input_filename.endswith('.idl'):
continue
« no previous file with comments | « Source/bindings/scripts/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698