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

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

Issue 1868723002: Allow location of test_runner.py to be overriden in GYP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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/test_runner.gypi » ('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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 sys.exit(main()) 43 sys.exit(main())
44 """ 44 """
45 45
46 def main(args): 46 def main(args):
47 parser = argparse.ArgumentParser() 47 parser = argparse.ArgumentParser()
48 parser.add_argument('--script-output-path', 48 parser.add_argument('--script-output-path',
49 help='Output path for executable script.') 49 help='Output path for executable script.')
50 parser.add_argument('--depfile', 50 parser.add_argument('--depfile',
51 help='Path to the depfile. This must be specified as ' 51 help='Path to the depfile. This must be specified as '
52 "the action's first output.") 52 "the action's first output.")
53 parser.add_argument('--test-runner-path',
54 help='Path to test_runner.py (optional).')
53 # 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
54 # of the paths relative to the output script directory. 56 # of the paths relative to the output script directory.
55 group = parser.add_argument_group('Test runner path arguments.') 57 group = parser.add_argument_group('Test runner path arguments.')
56 group.add_argument('--additional-apk', action='append', 58 group.add_argument('--additional-apk', action='append',
57 dest='additional_apks', default=[]) 59 dest='additional_apks', default=[])
58 group.add_argument('--additional-apk-list') 60 group.add_argument('--additional-apk-list')
59 group.add_argument('--apk-under-test') 61 group.add_argument('--apk-under-test')
60 group.add_argument('--apk-under-test-incremental-install-script') 62 group.add_argument('--apk-under-test-incremental-install-script')
61 group.add_argument('--isolate-file-path') 63 group.add_argument('--isolate-file-path')
62 group.add_argument('--output-directory') 64 group.add_argument('--output-directory')
63 group.add_argument('--test-apk') 65 group.add_argument('--test-apk')
64 group.add_argument('--test-apk-incremental-install-script') 66 group.add_argument('--test-apk-incremental-install-script')
65 group.add_argument('--coverage-dir') 67 group.add_argument('--coverage-dir')
66 args, test_runner_args = parser.parse_known_args( 68 args, test_runner_args = parser.parse_known_args(
67 build_utils.ExpandFileArgs(args)) 69 build_utils.ExpandFileArgs(args))
68 70
69 def RelativizePathToScript(path): 71 def RelativizePathToScript(path):
70 """Returns the path relative to the output script directory.""" 72 """Returns the path relative to the output script directory."""
71 return os.path.relpath(path, os.path.dirname(args.script_output_path)) 73 return os.path.relpath(path, os.path.dirname(args.script_output_path))
72 74
73 test_runner_path = os.path.join( 75 test_runner_path = args.test_runner_path or os.path.join(
74 os.path.dirname(__file__), os.path.pardir, 'test_runner.py') 76 os.path.dirname(__file__), os.path.pardir, 'test_runner.py')
75 test_runner_path = RelativizePathToScript(test_runner_path) 77 test_runner_path = RelativizePathToScript(test_runner_path)
76 78
77 test_runner_path_args = [] 79 test_runner_path_args = []
78 if args.additional_apk_list: 80 if args.additional_apk_list:
79 args.additional_apks.extend( 81 args.additional_apks.extend(
80 build_utils.ParseGypList(args.additional_apk_list)) 82 build_utils.ParseGypList(args.additional_apk_list))
81 if args.additional_apks: 83 if args.additional_apks:
82 test_runner_path_args.extend( 84 test_runner_path_args.extend(
83 ('--additional-apk', RelativizePathToScript(a)) 85 ('--additional-apk', RelativizePathToScript(a))
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 117
116 os.chmod(args.script_output_path, 0750) 118 os.chmod(args.script_output_path, 0750)
117 119
118 if args.depfile: 120 if args.depfile:
119 build_utils.WriteDepfile( 121 build_utils.WriteDepfile(
120 args.depfile, 122 args.depfile,
121 build_utils.GetPythonDependencies()) 123 build_utils.GetPythonDependencies())
122 124
123 if __name__ == '__main__': 125 if __name__ == '__main__':
124 sys.exit(main(sys.argv[1:])) 126 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | build/android/test_runner.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698