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 copy |
12 import os | 12 import os |
13 import subprocess | 13 import subprocess |
14 import sys | 14 import sys |
15 | 15 |
16 | 16 |
17 SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | 17 SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) |
18 | 18 |
19 | 19 |
20 def main(argv): | 20 def main(argv): |
21 parser = argparse.ArgumentParser() | 21 parser = argparse.ArgumentParser() |
22 # TODO(phajdan.jr): Remove after cleaning up build repo side. | 22 # TODO(phajdan.jr): Remove after cleaning up build repo side. |
23 parser.add_argument( | 23 parser.add_argument( |
24 '--path-build', help='Path to the build repo') | 24 '--path-build', help='Path to the build repo') |
25 parser.add_argument('args', nargs='*', help='Arguments to pass to runtest.py') | 25 parser.add_argument('args', nargs=argparse.REMAINDER, |
26 help='Arguments to pass to runtest.py') | |
26 args = parser.parse_args(argv) | 27 args = parser.parse_args(argv) |
28 runtest_args = args.args | |
29 if runtest_args[0] == '--': | |
Paweł Hajdan Jr.
2015/09/24 14:29:22
Wait, why is this logic needed?
I wouldn't mind t
nednguyen
2015/09/24 15:54:54
To use the isolate_script_test, we need to add the
| |
30 runtest_args.pop(0) | |
27 | 31 |
28 env = copy.copy(os.environ) | 32 env = copy.copy(os.environ) |
29 # Reset PYTHONPATH to make sure we're not accidentally using | 33 # Reset PYTHONPATH to make sure we're not accidentally using |
30 # the buildbot-provided value and build-side modules. That would make | 34 # the buildbot-provided value and build-side modules. That would make |
31 # changes inside this directory not take effect on buildbot. | 35 # changes inside this directory not take effect on buildbot. |
32 pythonpath = [] | 36 pythonpath = [] |
33 pythonpath.append(os.path.join( | 37 pythonpath.append(os.path.join( |
34 SRC_DIR, 'infra', 'scripts', 'legacy', 'scripts')) | 38 SRC_DIR, 'infra', 'scripts', 'legacy', 'scripts')) |
35 pythonpath.append(os.path.join( | 39 pythonpath.append(os.path.join( |
36 SRC_DIR, 'infra', 'scripts', 'legacy', 'site_config')) | 40 SRC_DIR, 'infra', 'scripts', 'legacy', 'site_config')) |
37 pythonpath.append(os.path.join( | 41 pythonpath.append(os.path.join( |
38 SRC_DIR, 'third_party')) | 42 SRC_DIR, 'third_party')) |
39 env['PYTHONPATH'] = os.pathsep.join(pythonpath) | 43 env['PYTHONPATH'] = os.pathsep.join(pythonpath) |
40 | 44 |
41 return subprocess.call([ | 45 return subprocess.call([ |
42 sys.executable, | 46 sys.executable, |
43 os.path.join(SRC_DIR, 'infra', 'scripts', 'legacy', | 47 os.path.join(SRC_DIR, 'infra', 'scripts', 'legacy', |
44 'scripts', 'slave', 'runtest.py') | 48 'scripts', 'slave', 'runtest.py') |
45 ] + args.args, env=env) | 49 ] + runtest_args, env=env) |
46 | 50 |
47 | 51 |
48 if __name__ == '__main__': | 52 if __name__ == '__main__': |
49 sys.exit(main(sys.argv[1:])) | 53 sys.exit(main(sys.argv[1:])) |
OLD | NEW |