Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: build/android/gyp/create_test_runner_script.py

Issue 2536373005: Add --test-jar arg to test_runner to explicitly specify its path. (Closed)
Patch Set: Added required=True Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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('--runtime-deps-path')
66 group.add_argument('--test-apk') 66 group.add_argument('--test-apk')
67 group.add_argument('--test-jar')
67 group.add_argument('--test-apk-incremental-install-script') 68 group.add_argument('--test-apk-incremental-install-script')
68 group.add_argument('--coverage-dir') 69 group.add_argument('--coverage-dir')
69 args, test_runner_args = parser.parse_known_args( 70 args, test_runner_args = parser.parse_known_args(
70 build_utils.ExpandFileArgs(args)) 71 build_utils.ExpandFileArgs(args))
71 72
72 def RelativizePathToScript(path): 73 def RelativizePathToScript(path):
73 """Returns the path relative to the output script directory.""" 74 """Returns the path relative to the output script directory."""
74 return os.path.relpath(path, os.path.dirname(args.script_output_path)) 75 return os.path.relpath(path, os.path.dirname(args.script_output_path))
75 76
76 test_runner_path = args.test_runner_path or os.path.join( 77 test_runner_path = args.test_runner_path or os.path.join(
(...skipping 25 matching lines...) Expand all
102 ('--isolate-file-path', RelativizePathToScript(args.isolate_file_path))) 103 ('--isolate-file-path', RelativizePathToScript(args.isolate_file_path)))
103 if args.output_directory: 104 if args.output_directory:
104 test_runner_path_args.append( 105 test_runner_path_args.append(
105 ('--output-directory', RelativizePathToScript(args.output_directory))) 106 ('--output-directory', RelativizePathToScript(args.output_directory)))
106 if args.runtime_deps_path: 107 if args.runtime_deps_path:
107 test_runner_path_args.append( 108 test_runner_path_args.append(
108 ('--runtime-deps-path', RelativizePathToScript(args.runtime_deps_path))) 109 ('--runtime-deps-path', RelativizePathToScript(args.runtime_deps_path)))
109 if args.test_apk: 110 if args.test_apk:
110 test_runner_path_args.append( 111 test_runner_path_args.append(
111 ('--test-apk', RelativizePathToScript(args.test_apk))) 112 ('--test-apk', RelativizePathToScript(args.test_apk)))
113 if args.test_jar:
114 test_runner_path_args.append(
115 ('--test-jar', RelativizePathToScript(args.test_jar)))
112 if args.test_apk_incremental_install_script: 116 if args.test_apk_incremental_install_script:
113 test_runner_path_args.append( 117 test_runner_path_args.append(
114 ('--test-apk-incremental-install-script', 118 ('--test-apk-incremental-install-script',
115 RelativizePathToScript(args.test_apk_incremental_install_script))) 119 RelativizePathToScript(args.test_apk_incremental_install_script)))
116 if args.coverage_dir: 120 if args.coverage_dir:
117 test_runner_path_args.append( 121 test_runner_path_args.append(
118 ('--coverage-dir', RelativizePathToScript(args.coverage_dir))) 122 ('--coverage-dir', RelativizePathToScript(args.coverage_dir)))
119 123
120 with open(args.script_output_path, 'w') as script: 124 with open(args.script_output_path, 'w') as script:
121 script.write(SCRIPT_TEMPLATE.format( 125 script.write(SCRIPT_TEMPLATE.format(
122 test_runner_path=str(test_runner_path), 126 test_runner_path=str(test_runner_path),
123 test_runner_args=str(test_runner_args), 127 test_runner_args=str(test_runner_args),
124 test_runner_path_args=str(test_runner_path_args))) 128 test_runner_path_args=str(test_runner_path_args)))
125 129
126 os.chmod(args.script_output_path, 0750) 130 os.chmod(args.script_output_path, 0750)
127 131
128 if args.depfile: 132 if args.depfile:
129 build_utils.WriteDepfile(args.depfile, args.script_output_path) 133 build_utils.WriteDepfile(args.depfile, args.script_output_path)
130 134
131 if __name__ == '__main__': 135 if __name__ == '__main__':
132 sys.exit(main(sys.argv[1:])) 136 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698