| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 parser.add_argument('--test-runner-path', | 53 parser.add_argument('--test-runner-path', |
| 54 help='Path to test_runner.py (optional).') | 54 help='Path to test_runner.py (optional).') |
| 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('--additional-apk', action='append', | 58 group.add_argument('--additional-apk', action='append', |
| 59 dest='additional_apks', default=[]) | 59 dest='additional_apks', default=[]) |
| 60 group.add_argument('--additional-apk-list') | 60 group.add_argument('--additional-apk-list') |
| 61 group.add_argument('--apk-under-test') | 61 group.add_argument('--apk-under-test') |
| 62 group.add_argument('--apk-under-test-incremental-install-script') | 62 group.add_argument('--apk-under-test-incremental-install-script') |
| 63 group.add_argument('--executable-dist-dir') |
| 63 group.add_argument('--isolate-file-path') | 64 group.add_argument('--isolate-file-path') |
| 64 group.add_argument('--output-directory') | 65 group.add_argument('--output-directory') |
| 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.""" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 ('--additional-apk', RelativizePathToScript(a)) | 86 ('--additional-apk', RelativizePathToScript(a)) |
| 86 for a in args.additional_apks) | 87 for a in args.additional_apks) |
| 87 if args.apk_under_test: | 88 if args.apk_under_test: |
| 88 test_runner_path_args.append( | 89 test_runner_path_args.append( |
| 89 ('--apk-under-test', RelativizePathToScript(args.apk_under_test))) | 90 ('--apk-under-test', RelativizePathToScript(args.apk_under_test))) |
| 90 if args.apk_under_test_incremental_install_script: | 91 if args.apk_under_test_incremental_install_script: |
| 91 test_runner_path_args.append( | 92 test_runner_path_args.append( |
| 92 ('--apk-under-test-incremental-install-script', | 93 ('--apk-under-test-incremental-install-script', |
| 93 RelativizePathToScript( | 94 RelativizePathToScript( |
| 94 args.apk_under_test_incremental_install_script))) | 95 args.apk_under_test_incremental_install_script))) |
| 96 if args.executable_dist_dir: |
| 97 test_runner_path_args.append( |
| 98 ('--executable-dist-dir', |
| 99 RelativizePathToScript(args.executable_dist_dir))) |
| 95 if args.isolate_file_path: | 100 if args.isolate_file_path: |
| 96 test_runner_path_args.append( | 101 test_runner_path_args.append( |
| 97 ('--isolate-file-path', RelativizePathToScript(args.isolate_file_path))) | 102 ('--isolate-file-path', RelativizePathToScript(args.isolate_file_path))) |
| 98 if args.output_directory: | 103 if args.output_directory: |
| 99 test_runner_path_args.append( | 104 test_runner_path_args.append( |
| 100 ('--output-directory', RelativizePathToScript(args.output_directory))) | 105 ('--output-directory', RelativizePathToScript(args.output_directory))) |
| 101 if args.test_apk: | 106 if args.test_apk: |
| 102 test_runner_path_args.append( | 107 test_runner_path_args.append( |
| 103 ('--test-apk', RelativizePathToScript(args.test_apk))) | 108 ('--test-apk', RelativizePathToScript(args.test_apk))) |
| 104 if args.test_apk_incremental_install_script: | 109 if args.test_apk_incremental_install_script: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 117 | 122 |
| 118 os.chmod(args.script_output_path, 0750) | 123 os.chmod(args.script_output_path, 0750) |
| 119 | 124 |
| 120 if args.depfile: | 125 if args.depfile: |
| 121 build_utils.WriteDepfile( | 126 build_utils.WriteDepfile( |
| 122 args.depfile, | 127 args.depfile, |
| 123 build_utils.GetPythonDependencies()) | 128 build_utils.GetPythonDependencies()) |
| 124 | 129 |
| 125 if __name__ == '__main__': | 130 if __name__ == '__main__': |
| 126 sys.exit(main(sys.argv[1:])) | 131 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |