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

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

Issue 1544803003: GN: Set --coverage-dir in bin/run_* script when emma_coverage = true (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add gypi support Created 5 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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 parser.add_argument('--depfile', 51 parser.add_argument('--depfile',
52 help='Path to the depfile. This must be specified as ' 52 help='Path to the depfile. This must be specified as '
53 "the action's first output.") 53 "the action's first output.")
54 # We need to intercept any test runner path arguments and make all 54 # We need to intercept any test runner path arguments and make all
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('--output-directory') 57 group.add_argument('--output-directory')
58 group.add_argument('--isolate-file-path') 58 group.add_argument('--isolate-file-path')
59 group.add_argument('--apk-under-test') 59 group.add_argument('--apk-under-test')
60 group.add_argument('--test-apk') 60 group.add_argument('--test-apk')
61 group.add_argument('--coverage-dir')
61 args, test_runner_args = parser.parse_known_args( 62 args, test_runner_args = parser.parse_known_args(
62 build_utils.ExpandFileArgs(args)) 63 build_utils.ExpandFileArgs(args))
63 64
64 def RelativizePathToScript(path): 65 def RelativizePathToScript(path):
65 """Returns the path relative to the output script directory.""" 66 """Returns the path relative to the output script directory."""
66 return os.path.relpath(path, os.path.dirname(args.script_output_path)) 67 return os.path.relpath(path, os.path.dirname(args.script_output_path))
67 68
68 test_runner_path = os.path.join( 69 test_runner_path = os.path.join(
69 os.path.dirname(__file__), os.path.pardir, 'test_runner.py') 70 os.path.dirname(__file__), os.path.pardir, 'test_runner.py')
70 test_runner_path = RelativizePathToScript(test_runner_path) 71 test_runner_path = RelativizePathToScript(test_runner_path)
71 72
72 test_runner_path_args = {} 73 test_runner_path_args = {}
73 if args.output_directory: 74 if args.output_directory:
74 test_runner_path_args['--output-directory'] = RelativizePathToScript( 75 test_runner_path_args['--output-directory'] = RelativizePathToScript(
75 args.output_directory) 76 args.output_directory)
76 if args.isolate_file_path: 77 if args.isolate_file_path:
77 test_runner_path_args['--isolate-file-path'] = RelativizePathToScript( 78 test_runner_path_args['--isolate-file-path'] = RelativizePathToScript(
78 args.isolate_file_path) 79 args.isolate_file_path)
79 if args.apk_under_test: 80 if args.apk_under_test:
80 test_runner_path_args['--apk-under-test'] = RelativizePathToScript( 81 test_runner_path_args['--apk-under-test'] = RelativizePathToScript(
81 args.apk_under_test) 82 args.apk_under_test)
82 if args.test_apk: 83 if args.test_apk:
83 test_runner_path_args['--test-apk'] = RelativizePathToScript( 84 test_runner_path_args['--test-apk'] = RelativizePathToScript(
84 args.test_apk) 85 args.test_apk)
86 if args.coverage_dir:
87 test_runner_path_args['--coverage-dir'] = RelativizePathToScript(
88 args.coverage_dir)
85 89
86 with open(args.script_output_path, 'w') as script: 90 with open(args.script_output_path, 'w') as script:
87 script.write(SCRIPT_TEMPLATE.format( 91 script.write(SCRIPT_TEMPLATE.format(
88 test_runner_path=str(test_runner_path), 92 test_runner_path=str(test_runner_path),
89 test_runner_args=str(test_runner_args), 93 test_runner_args=str(test_runner_args),
90 test_runner_path_args=str(test_runner_path_args))) 94 test_runner_path_args=str(test_runner_path_args)))
91 95
92 os.chmod(args.script_output_path, 0750) 96 os.chmod(args.script_output_path, 0750)
93 97
94 if args.depfile: 98 if args.depfile:
95 build_utils.WriteDepfile( 99 build_utils.WriteDepfile(
96 args.depfile, 100 args.depfile,
97 build_utils.GetPythonDependencies()) 101 build_utils.GetPythonDependencies())
98 102
99 if __name__ == '__main__': 103 if __name__ == '__main__':
100 sys.exit(main(sys.argv[1:])) 104 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