| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A tool to run a chrome test executable directly, or in isolated mode.""" | 6 """A tool to run a chrome test executable directly, or in isolated mode.""" |
| 7 | 7 |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import optparse | 10 import optparse |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 isn't generally true, so rewrite the paths in the isolated file. See | 97 isn't generally true, so rewrite the paths in the isolated file. See |
| 98 http://crbug.com/311622 for details. This can go away once all bots using | 98 http://crbug.com/311622 for details. This can go away once all bots using |
| 99 isolates are using ninja. | 99 isolates are using ninja. |
| 100 """ | 100 """ |
| 101 # See the isolates file format description at: | 101 # See the isolates file format description at: |
| 102 # https://code.google.com/p/swarming/wiki/IsolatedDesign#.isolated_file_format | 102 # https://code.google.com/p/swarming/wiki/IsolatedDesign#.isolated_file_format |
| 103 with open(isolated_file) as f: | 103 with open(isolated_file) as f: |
| 104 isolated_data = json.load(f) | 104 isolated_data = json.load(f) |
| 105 | 105 |
| 106 # 1. check version | 106 # 1. check version |
| 107 if isolated_data['version'] != '1.0': | 107 if isolated_data['version'].split('.', 1)[0] != '1': |
| 108 logging.error('Unexpected isolate version %s', isolated_data['version']) | 108 logging.error('Unexpected isolate version %s', isolated_data['version']) |
| 109 return 1 | 109 return 1 |
| 110 | 110 |
| 111 # 2. fix command, print it | 111 # 2. fix command, print it |
| 112 for i in range(len(isolated_data['command'])): | 112 for i in range(len(isolated_data['command'])): |
| 113 arg = isolated_data['command'][i] | 113 arg = isolated_data['command'][i] |
| 114 isolated_data['command'][i] = sanitize_build_dir(arg, build_dir_basename) | 114 isolated_data['command'][i] = sanitize_build_dir(arg, build_dir_basename) |
| 115 | 115 |
| 116 # 3. fix files | 116 # 3. fix files |
| 117 sanitized_files = {} | 117 sanitized_files = {} |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 isolate_script = os.path.join(options.checkout_dir, 'src', 'tools', | 224 isolate_script = os.path.join(options.checkout_dir, 'src', 'tools', |
| 225 'swarm_client', 'isolate.py') | 225 'swarm_client', 'isolate.py') |
| 226 return run_test_isolated(isolate_script, test_exe, original_command) | 226 return run_test_isolated(isolate_script, test_exe, original_command) |
| 227 else: | 227 else: |
| 228 logging.info('Running test normally') | 228 logging.info('Running test normally') |
| 229 return run_command(original_command) | 229 return run_command(original_command) |
| 230 | 230 |
| 231 | 231 |
| 232 if '__main__' == __name__: | 232 if '__main__' == __name__: |
| 233 sys.exit(main(None)) | 233 sys.exit(main(None)) |
| OLD | NEW |