| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import argparse | 5 import argparse |
| 6 import contextlib | 6 import contextlib |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 run_parser = subparsers.add_parser('compile_targets') | 57 run_parser = subparsers.add_parser('compile_targets') |
| 58 run_parser.add_argument( | 58 run_parser.add_argument( |
| 59 '--output', type=argparse.FileType('w'), required=True) | 59 '--output', type=argparse.FileType('w'), required=True) |
| 60 run_parser.set_defaults(func=funcs['compile_targets']) | 60 run_parser.set_defaults(func=funcs['compile_targets']) |
| 61 | 61 |
| 62 args = parser.parse_args(argv) | 62 args = parser.parse_args(argv) |
| 63 return args.func(args) | 63 return args.func(args) |
| 64 | 64 |
| 65 | 65 |
| 66 def run_command(argv, env=None): | 66 def run_command(argv, env=None, cwd=None): |
| 67 print 'Running %r' % argv | 67 print 'Running %r in %r (env: %r)' % (argv, cwd, env) |
| 68 rc = subprocess.call(argv, env=env) | 68 rc = subprocess.call(argv, env=env, cwd=cwd) |
| 69 print 'Command %r returned exit code %d' % (argv, rc) | 69 print 'Command %r returned exit code %d' % (argv, rc) |
| 70 return rc | 70 return rc |
| 71 | 71 |
| 72 | 72 |
| 73 def run_runtest(cmd_args, runtest_args): | 73 def run_runtest(cmd_args, runtest_args): |
| 74 if cmd_args.use_src_side_runtest_py: | 74 if cmd_args.use_src_side_runtest_py: |
| 75 cmd = [ | 75 cmd = [ |
| 76 sys.executable, | 76 sys.executable, |
| 77 os.path.join( | 77 os.path.join( |
| 78 cmd_args.paths['checkout'], 'infra', 'scripts', 'runtest_wrapper.py'), | 78 cmd_args.paths['checkout'], 'infra', 'scripts', 'runtest_wrapper.py'), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 [sys.executable, script_to_run] + extra_args) | 163 [sys.executable, script_to_run] + extra_args) |
| 164 | 164 |
| 165 with open(log_file) as f: | 165 with open(log_file) as f: |
| 166 failures = json.load(f) | 166 failures = json.load(f) |
| 167 json.dump({ | 167 json.dump({ |
| 168 'valid': integration_test_res == 0, | 168 'valid': integration_test_res == 0, |
| 169 'failures': failures, | 169 'failures': failures, |
| 170 }, output) | 170 }, output) |
| 171 | 171 |
| 172 return integration_test_res | 172 return integration_test_res |
| OLD | NEW |