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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 group.add_argument('--isolate-file-path') | 75 group.add_argument('--isolate-file-path') |
76 group.add_argument('--output-directory') | 76 group.add_argument('--output-directory') |
77 group.add_argument('--runtime-deps-path') | 77 group.add_argument('--runtime-deps-path') |
78 group.add_argument('--test-apk') | 78 group.add_argument('--test-apk') |
79 group.add_argument('--test-jar') | 79 group.add_argument('--test-jar') |
80 group.add_argument('--test-apk-incremental-install-script') | 80 group.add_argument('--test-apk-incremental-install-script') |
81 group.add_argument('--coverage-dir') | 81 group.add_argument('--coverage-dir') |
82 group.add_argument('--android-manifest-path') | 82 group.add_argument('--android-manifest-path') |
83 group.add_argument('--resource-zips') | 83 group.add_argument('--resource-zips') |
84 group.add_argument('--robolectric-runtime-deps-dir') | 84 group.add_argument('--robolectric-runtime-deps-dir') |
| 85 group.add_argument('--enable-relocation-packing') |
85 args, test_runner_args = parser.parse_known_args( | 86 args, test_runner_args = parser.parse_known_args( |
86 build_utils.ExpandFileArgs(args)) | 87 build_utils.ExpandFileArgs(args)) |
87 | 88 |
88 def RelativizePathToScript(path): | 89 def RelativizePathToScript(path): |
89 """Returns the path relative to the output script directory.""" | 90 """Returns the path relative to the output script directory.""" |
90 return os.path.relpath(path, os.path.dirname(args.script_output_path)) | 91 return os.path.relpath(path, os.path.dirname(args.script_output_path)) |
91 | 92 |
92 test_runner_path = args.test_runner_path or os.path.join( | 93 test_runner_path = args.test_runner_path or os.path.join( |
93 os.path.dirname(__file__), os.path.pardir, 'test_runner.py') | 94 os.path.dirname(__file__), os.path.pardir, 'test_runner.py') |
94 test_runner_path = RelativizePathToScript(test_runner_path) | 95 test_runner_path = RelativizePathToScript(test_runner_path) |
95 | 96 |
96 test_runner_path_args = [] | 97 test_runner_path_args = [] |
| 98 if args.enable_relocation_packing and args.enable_relocation_packing == "1": |
| 99 test_runner_args.append('--enable-relocation-packing') |
97 if args.additional_apk_list: | 100 if args.additional_apk_list: |
98 args.additional_apks.extend( | 101 args.additional_apks.extend( |
99 build_utils.ParseGnList(args.additional_apk_list)) | 102 build_utils.ParseGnList(args.additional_apk_list)) |
100 if args.additional_apks: | 103 if args.additional_apks: |
101 test_runner_path_args.extend( | 104 test_runner_path_args.extend( |
102 ('--additional-apk', RelativizePathToScript(a)) | 105 ('--additional-apk', RelativizePathToScript(a)) |
103 for a in args.additional_apks) | 106 for a in args.additional_apks) |
104 if args.additional_apks_incremental: | 107 if args.additional_apks_incremental: |
105 bad_additional_apks = [a for a in args.additional_apks_incremental | 108 bad_additional_apks = [a for a in args.additional_apks_incremental |
106 if a != 'None'] | 109 if a != 'None'] |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 test_runner_args=str(test_runner_args), | 162 test_runner_args=str(test_runner_args), |
160 test_runner_path_args=str(test_runner_path_args))) | 163 test_runner_path_args=str(test_runner_path_args))) |
161 | 164 |
162 os.chmod(args.script_output_path, 0750) | 165 os.chmod(args.script_output_path, 0750) |
163 | 166 |
164 if args.depfile: | 167 if args.depfile: |
165 build_utils.WriteDepfile(args.depfile, args.script_output_path) | 168 build_utils.WriteDepfile(args.depfile, args.script_output_path) |
166 | 169 |
167 if __name__ == '__main__': | 170 if __name__ == '__main__': |
168 sys.exit(main(sys.argv[1:])) | 171 sys.exit(main(sys.argv[1:])) |
OLD | NEW |