OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Creates a script to run an android test using build/android/test_runner.py. | 7 """Creates a script to run an android test using build/android/test_runner.py. |
8 """ | 8 """ |
9 | 9 |
10 import argparse | 10 import argparse |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 parser.add_argument('--script-output-path', | 50 parser.add_argument('--script-output-path', |
51 help='Output path for executable script.') | 51 help='Output path for executable script.') |
52 parser.add_argument('--depfile', | 52 parser.add_argument('--depfile', |
53 help='Path to the depfile. This must be specified as ' | 53 help='Path to the depfile. This must be specified as ' |
54 "the action's first output.") | 54 "the action's first output.") |
55 # We need to intercept any test runner path arguments and make all | 55 # We need to intercept any test runner path arguments and make all |
56 # of the paths relative to the output script directory. | 56 # of the paths relative to the output script directory. |
57 group = parser.add_argument_group('Test runner path arguments.') | 57 group = parser.add_argument_group('Test runner path arguments.') |
58 group.add_argument('--output-directory') | 58 group.add_argument('--output-directory') |
59 group.add_argument('--isolate-file-path') | 59 group.add_argument('--isolate-file-path') |
| 60 group.add_argument('--support-apk') |
60 args, test_runner_args = parser.parse_known_args() | 61 args, test_runner_args = parser.parse_known_args() |
61 | 62 |
62 def RelativizePathToScript(path): | 63 def RelativizePathToScript(path): |
63 """Returns the path relative to the output script directory.""" | 64 """Returns the path relative to the output script directory.""" |
64 return os.path.relpath(path, os.path.dirname(args.script_output_path)) | 65 return os.path.relpath(path, os.path.dirname(args.script_output_path)) |
65 | 66 |
66 test_runner_path = os.path.join( | 67 test_runner_path = os.path.join( |
67 os.path.dirname(__file__), os.path.pardir, 'test_runner.py') | 68 os.path.dirname(__file__), os.path.pardir, 'test_runner.py') |
68 test_runner_path = RelativizePathToScript(test_runner_path) | 69 test_runner_path = RelativizePathToScript(test_runner_path) |
69 | 70 |
70 test_runner_path_args = {} | 71 test_runner_path_args = {} |
71 if args.output_directory: | 72 if args.output_directory: |
72 test_runner_path_args['--output-directory'] = RelativizePathToScript( | 73 test_runner_path_args['--output-directory'] = RelativizePathToScript( |
73 args.output_directory) | 74 args.output_directory) |
74 if args.isolate_file_path: | 75 if args.isolate_file_path: |
75 test_runner_path_args['--isolate-file-path'] = RelativizePathToScript( | 76 test_runner_path_args['--isolate-file-path'] = RelativizePathToScript( |
76 args.isolate_file_path) | 77 args.isolate_file_path) |
| 78 if args.support_apk: |
| 79 test_runner_path_args['--support-apk'] = RelativizePathToScript( |
| 80 args.support_apk) |
77 | 81 |
78 with open(args.script_output_path, 'w') as script: | 82 with open(args.script_output_path, 'w') as script: |
79 script.write(SCRIPT_TEMPLATE.format( | 83 script.write(SCRIPT_TEMPLATE.format( |
80 test_runner_path=str(test_runner_path), | 84 test_runner_path=str(test_runner_path), |
81 test_runner_args=str(test_runner_args), | 85 test_runner_args=str(test_runner_args), |
82 test_runner_path_args=str(test_runner_path_args))) | 86 test_runner_path_args=str(test_runner_path_args))) |
83 | 87 |
84 os.chmod(args.script_output_path, 0750) | 88 os.chmod(args.script_output_path, 0750) |
85 | 89 |
86 if args.depfile: | 90 if args.depfile: |
87 build_utils.WriteDepfile( | 91 build_utils.WriteDepfile( |
88 args.depfile, | 92 args.depfile, |
89 build_utils.GetPythonDependencies()) | 93 build_utils.GetPythonDependencies()) |
90 | 94 |
91 if __name__ == '__main__': | 95 if __name__ == '__main__': |
92 sys.exit(main()) | 96 sys.exit(main()) |
OLD | NEW |