diff options
-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( |