diff options
author | vadimsh <vadimsh@chromium.org> | 2014-09-09 00:20:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-09 07:26:08 +0000 |
commit | 8556ebdc21ada4753aa6798a240c83101f212dcf (patch) | |
tree | 8d1c647cf9743872f5e446444d592ac56af0bd83 | |
parent | 30f9a0e253bc3a325ec85ff768d03c2f46a72244 (diff) | |
download | chromium_src-8556ebdc21ada4753aa6798a240c83101f212dcf.zip chromium_src-8556ebdc21ada4753aa6798a240c83101f212dcf.tar.gz chromium_src-8556ebdc21ada4753aa6798a240c83101f212dcf.tar.bz2 |
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}
-rw-r--r-- | build/isolate.gypi | 15 | ||||
-rwxr-xr-x | tools/isolate_driver.py | 25 |
2 files changed, 34 insertions, 6 deletions
diff --git a/build/isolate.gypi b/build/isolate.gypi index b0b2ca0..907fbb5 100644 --- a/build/isolate.gypi +++ b/build/isolate.gypi @@ -63,14 +63,12 @@ # the switch-over to running tests on Swarm is completed. #'<@(isolate_dependency_tracked)', ], - 'outputs': [ - '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated', - ], + 'outputs': [], 'action': [ 'python', '<(DEPTH)/tools/isolate_driver.py', '<(test_isolation_mode)', - '--isolated', '<@(_outputs)', + '--isolated', '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated', '--isolate', '<(RULE_INPUT_PATH)', # Variables should use the -V FOO=<(FOO) form so frequent values, @@ -118,6 +116,15 @@ ['test_isolation_fail_on_missing == 0', { 'action': ['--ignore_broken_items'], }], + ["test_isolation_mode == 'prepare'", { + 'outputs': [ + '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated.gen.json', + ], + }, { + 'outputs': [ + '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated', + ], + }], ], }, ], diff --git a/tools/isolate_driver.py b/tools/isolate_driver.py index 192de2c..73ad0d6 100755 --- a/tools/isolate_driver.py +++ b/tools/isolate_driver.py @@ -19,11 +19,12 @@ WARNING: The target to use for build.ninja analysis is the base name of the 'foo_test_run' analysed. """ -import StringIO import glob +import json import logging import os import posixpath +import StringIO import subprocess import sys import time @@ -248,9 +249,23 @@ def create_wrapper(args, isolate_index, isolated_index): 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(): logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s') args = sys.argv[1:] + mode = args[0] if args else None isolate = None isolated = None is_component = False @@ -261,13 +276,19 @@ def main(): isolated = i + 1 if arg == 'component=shared_library': 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' return 1 if is_component: 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') sys.stdout.flush() result = subprocess.call( |