Commit 8556ebdc authored by vadimsh's avatar vadimsh Committed by Commit bot

Add new isolation mode "prepare".

In that mode isolate_driver.py will collect all arguments needed for
isolate.py invocation into *.isolated.gen.json file, but won't actually
run the isolation itself.

It's a feature of isolate_driver.py. Isolate client itself knows nothing about
this mode.

BUG=389227
R=maruel@chromium.org

Review URL: https://codereview.chromium.org/555553002

Cr-Commit-Position: refs/heads/master@{#293885}
parent 30f9a0e2
...@@ -63,14 +63,12 @@ ...@@ -63,14 +63,12 @@
# the switch-over to running tests on Swarm is completed. # the switch-over to running tests on Swarm is completed.
#'<@(isolate_dependency_tracked)', #'<@(isolate_dependency_tracked)',
], ],
'outputs': [ 'outputs': [],
'<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated',
],
'action': [ 'action': [
'python', 'python',
'<(DEPTH)/tools/isolate_driver.py', '<(DEPTH)/tools/isolate_driver.py',
'<(test_isolation_mode)', '<(test_isolation_mode)',
'--isolated', '<@(_outputs)', '--isolated', '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated',
'--isolate', '<(RULE_INPUT_PATH)', '--isolate', '<(RULE_INPUT_PATH)',
# Variables should use the -V FOO=<(FOO) form so frequent values, # Variables should use the -V FOO=<(FOO) form so frequent values,
...@@ -118,6 +116,15 @@ ...@@ -118,6 +116,15 @@
['test_isolation_fail_on_missing == 0', { ['test_isolation_fail_on_missing == 0', {
'action': ['--ignore_broken_items'], 'action': ['--ignore_broken_items'],
}], }],
["test_isolation_mode == 'prepare'", {
'outputs': [
'<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated.gen.json',
],
}, {
'outputs': [
'<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated',
],
}],
], ],
}, },
], ],
......
...@@ -19,11 +19,12 @@ WARNING: The target to use for build.ninja analysis is the base name of the ...@@ -19,11 +19,12 @@ WARNING: The target to use for build.ninja analysis is the base name of the
'foo_test_run' analysed. 'foo_test_run' analysed.
""" """
import StringIO
import glob import glob
import json
import logging import logging
import os import os
import posixpath import posixpath
import StringIO
import subprocess import subprocess
import sys import sys
import time import time
...@@ -248,9 +249,23 @@ def create_wrapper(args, isolate_index, isolated_index): ...@@ -248,9 +249,23 @@ def create_wrapper(args, isolate_index, isolated_index):
args[isolate_index] = temp_isolate args[isolate_index] = temp_isolate
def prepare_isolate_call(args, output):
"""Gathers all information required to run isolate.py later.
Dumps it as JSON to |output| file.
"""
with open(output, 'wb') as f:
json.dump({
'args': args,
'dir': os.getcwd(),
'version': 1,
}, f, indent=2, sort_keys=True)
def main(): def main():
logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s') logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s')
args = sys.argv[1:] args = sys.argv[1:]
mode = args[0] if args else None
isolate = None isolate = None
isolated = None isolated = None
is_component = False is_component = False
...@@ -261,13 +276,19 @@ def main(): ...@@ -261,13 +276,19 @@ def main():
isolated = i + 1 isolated = i + 1
if arg == 'component=shared_library': if arg == 'component=shared_library':
is_component = True is_component = True
if isolate is None or isolated is None: if isolate is None or isolated is None or not mode:
print >> sys.stderr, 'Internal failure' print >> sys.stderr, 'Internal failure'
return 1 return 1
if is_component: if is_component:
create_wrapper(args, isolate, isolated) create_wrapper(args, isolate, isolated)
# In 'prepare' mode just collect all required information for postponed
# isolated.py invocation later, store it in *.isolated.gen.json file.
if mode == 'prepare':
prepare_isolate_call(args[1:], args[isolated] + '.gen.json')
return 0
swarming_client = os.path.join(SRC_DIR, 'tools', 'swarming_client') swarming_client = os.path.join(SRC_DIR, 'tools', 'swarming_client')
sys.stdout.flush() sys.stdout.flush()
result = subprocess.call( result = subprocess.call(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment