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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 # of the paths relative to the output script directory. | 55 # of the paths relative to the output script directory. |
56 group = parser.add_argument_group('Test runner path arguments.') | 56 group = parser.add_argument_group('Test runner path arguments.') |
57 group.add_argument('--additional-apk', action='append', | 57 group.add_argument('--additional-apk', action='append', |
58 dest='additional_apks', default=[]) | 58 dest='additional_apks', default=[]) |
59 group.add_argument('--additional-apk-list') | 59 group.add_argument('--additional-apk-list') |
60 group.add_argument('--apk-under-test') | 60 group.add_argument('--apk-under-test') |
61 group.add_argument('--apk-under-test-incremental-install-script') | 61 group.add_argument('--apk-under-test-incremental-install-script') |
62 group.add_argument('--executable-dist-dir') | 62 group.add_argument('--executable-dist-dir') |
63 group.add_argument('--isolate-file-path') | 63 group.add_argument('--isolate-file-path') |
64 group.add_argument('--output-directory') | 64 group.add_argument('--output-directory') |
| 65 group.add_argument('--runtime-deps-path') |
65 group.add_argument('--test-apk') | 66 group.add_argument('--test-apk') |
66 group.add_argument('--test-apk-incremental-install-script') | 67 group.add_argument('--test-apk-incremental-install-script') |
67 group.add_argument('--coverage-dir') | 68 group.add_argument('--coverage-dir') |
68 args, test_runner_args = parser.parse_known_args( | 69 args, test_runner_args = parser.parse_known_args( |
69 build_utils.ExpandFileArgs(args)) | 70 build_utils.ExpandFileArgs(args)) |
70 | 71 |
71 def RelativizePathToScript(path): | 72 def RelativizePathToScript(path): |
72 """Returns the path relative to the output script directory.""" | 73 """Returns the path relative to the output script directory.""" |
73 return os.path.relpath(path, os.path.dirname(args.script_output_path)) | 74 return os.path.relpath(path, os.path.dirname(args.script_output_path)) |
74 | 75 |
(...skipping 20 matching lines...) Expand all Loading... |
95 if args.executable_dist_dir: | 96 if args.executable_dist_dir: |
96 test_runner_path_args.append( | 97 test_runner_path_args.append( |
97 ('--executable-dist-dir', | 98 ('--executable-dist-dir', |
98 RelativizePathToScript(args.executable_dist_dir))) | 99 RelativizePathToScript(args.executable_dist_dir))) |
99 if args.isolate_file_path: | 100 if args.isolate_file_path: |
100 test_runner_path_args.append( | 101 test_runner_path_args.append( |
101 ('--isolate-file-path', RelativizePathToScript(args.isolate_file_path))) | 102 ('--isolate-file-path', RelativizePathToScript(args.isolate_file_path))) |
102 if args.output_directory: | 103 if args.output_directory: |
103 test_runner_path_args.append( | 104 test_runner_path_args.append( |
104 ('--output-directory', RelativizePathToScript(args.output_directory))) | 105 ('--output-directory', RelativizePathToScript(args.output_directory))) |
| 106 if args.runtime_deps_path: |
| 107 test_runner_path_args.append( |
| 108 ('--runtime-deps-path', RelativizePathToScript(args.runtime_deps_path))) |
105 if args.test_apk: | 109 if args.test_apk: |
106 test_runner_path_args.append( | 110 test_runner_path_args.append( |
107 ('--test-apk', RelativizePathToScript(args.test_apk))) | 111 ('--test-apk', RelativizePathToScript(args.test_apk))) |
108 if args.test_apk_incremental_install_script: | 112 if args.test_apk_incremental_install_script: |
109 test_runner_path_args.append( | 113 test_runner_path_args.append( |
110 ('--test-apk-incremental-install-script', | 114 ('--test-apk-incremental-install-script', |
111 RelativizePathToScript(args.test_apk_incremental_install_script))) | 115 RelativizePathToScript(args.test_apk_incremental_install_script))) |
112 if args.coverage_dir: | 116 if args.coverage_dir: |
113 test_runner_path_args.append( | 117 test_runner_path_args.append( |
114 ('--coverage-dir', RelativizePathToScript(args.coverage_dir))) | 118 ('--coverage-dir', RelativizePathToScript(args.coverage_dir))) |
115 | 119 |
116 with open(args.script_output_path, 'w') as script: | 120 with open(args.script_output_path, 'w') as script: |
117 script.write(SCRIPT_TEMPLATE.format( | 121 script.write(SCRIPT_TEMPLATE.format( |
118 test_runner_path=str(test_runner_path), | 122 test_runner_path=str(test_runner_path), |
119 test_runner_args=str(test_runner_args), | 123 test_runner_args=str(test_runner_args), |
120 test_runner_path_args=str(test_runner_path_args))) | 124 test_runner_path_args=str(test_runner_path_args))) |
121 | 125 |
122 os.chmod(args.script_output_path, 0750) | 126 os.chmod(args.script_output_path, 0750) |
123 | 127 |
124 if args.depfile: | 128 if args.depfile: |
125 build_utils.WriteDepfile(args.depfile, args.script_output_path) | 129 build_utils.WriteDepfile(args.depfile, args.script_output_path) |
126 | 130 |
127 if __name__ == '__main__': | 131 if __name__ == '__main__': |
128 sys.exit(main(sys.argv[1:])) | 132 sys.exit(main(sys.argv[1:])) |
OLD | NEW |