OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """Wrapper for runtest.py, makes it possible to control src-side | 6 """Wrapper for runtest.py, makes it possible to control src-side |
7 which file gets used and test the changes on trybots before landing.""" | 7 which file gets used and test the changes on trybots before landing.""" |
8 | 8 |
9 | 9 |
10 import argparse | 10 import argparse |
| 11 import copy |
11 import os | 12 import os |
12 import subprocess | 13 import subprocess |
13 import sys | 14 import sys |
14 | 15 |
15 | 16 |
| 17 SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) |
| 18 |
| 19 |
16 def main(argv): | 20 def main(argv): |
17 parser = argparse.ArgumentParser() | 21 parser = argparse.ArgumentParser() |
| 22 # TODO(phajdan.jr): Remove after cleaning up build repo side. |
18 parser.add_argument( | 23 parser.add_argument( |
19 '--path-build', required=True, help='Path to the build repo') | 24 '--path-build', help='Path to the build repo') |
20 parser.add_argument('args', nargs='*', help='Arguments to pass to runtest.py') | 25 parser.add_argument('args', nargs='*', help='Arguments to pass to runtest.py') |
21 args = parser.parse_args(argv) | 26 args = parser.parse_args(argv) |
| 27 |
| 28 env = copy.copy(os.environ) |
| 29 pythonpath = env.get('PYTHONPATH', '').split(':') |
| 30 pythonpath.append(os.path.join( |
| 31 SRC_DIR, 'infra', 'scripts', 'legacy', 'scripts')) |
| 32 pythonpath.append(os.path.join( |
| 33 SRC_DIR, 'infra', 'scripts', 'legacy', 'site_config')) |
| 34 env['PYTHONPATH'] = ':'.join(pythonpath) |
| 35 |
22 return subprocess.call([ | 36 return subprocess.call([ |
23 sys.executable, | 37 sys.executable, |
24 os.path.join(args.path_build, 'scripts', 'tools', 'runit.py'), | 38 os.path.join(SRC_DIR, 'infra', 'scripts', 'legacy', |
25 '--show-path', | 39 'scripts', 'slave', 'runtest.py') |
26 sys.executable, | 40 ] + args.args, env=env) |
27 os.path.join(args.path_build, 'scripts', 'slave', 'runtest.py') | |
28 ] + args.args) | |
29 | 41 |
30 | 42 |
31 if __name__ == '__main__': | 43 if __name__ == '__main__': |
32 sys.exit(main(sys.argv[1:])) | 44 sys.exit(main(sys.argv[1:])) |
OLD | NEW |