OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This a simple script to make building/testing Mojo components easier. | 6 # This a simple script to make building/testing Mojo components easier. |
7 | 7 |
8 import argparse | 8 import argparse |
9 from copy import deepcopy | 9 from copy import deepcopy |
10 import os | 10 import os |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return subprocess.call(['ninja', '-C', out_dir, 'root']) | 146 return subprocess.call(['ninja', '-C', out_dir, 'root']) |
147 | 147 |
148 | 148 |
149 def _run_tests(config, test_types): | 149 def _run_tests(config, test_types): |
150 """Runs the tests of the given type(s) for the given config.""" | 150 """Runs the tests of the given type(s) for the given config.""" |
151 | 151 |
152 assert isinstance(test_types, list) | 152 assert isinstance(test_types, list) |
153 config = deepcopy(config) | 153 config = deepcopy(config) |
154 config.values['test_types'] = test_types | 154 config.values['test_types'] = test_types |
155 | 155 |
156 if _get_gn_arg_value(_get_out_dir(config), 'is_asan') == 'true': | |
157 config.values["sanitizer"] = Config.SANITIZER_ASAN | |
158 | |
159 test_list = GetTestList(config) | 156 test_list = GetTestList(config) |
160 dry_run = config.values.get('dry_run') | 157 dry_run = config.values.get('dry_run') |
161 final_exit_code = 0 | 158 final_exit_code = 0 |
162 for entry in test_list: | 159 for entry in test_list: |
163 print 'Running: %s' % entry['name'] | 160 print 'Running: %s' % entry['name'] |
164 print 'Command: %s' % entry['command'] | 161 print 'Command: %s' % entry['command'] |
165 if dry_run: | 162 if dry_run: |
166 continue | 163 continue |
167 | 164 |
168 exit_code = subprocess.call(entry['command']) | 165 exit_code = subprocess.call(entry['command']) |
(...skipping 18 matching lines...) Expand all Loading... |
187 return _run_tests(config, ['dart']) | 184 return _run_tests(config, ['dart']) |
188 | 185 |
189 | 186 |
190 def main(): | 187 def main(): |
191 os.chdir(Paths().src_root) | 188 os.chdir(Paths().src_root) |
192 | 189 |
193 parser = argparse.ArgumentParser(description='A script to make building' | 190 parser = argparse.ArgumentParser(description='A script to make building' |
194 '/testing Mojo components easier.') | 191 '/testing Mojo components easier.') |
195 | 192 |
196 parent_parser = argparse.ArgumentParser(add_help=False) | 193 parent_parser = argparse.ArgumentParser(add_help=False) |
| 194 parent_parser.add_argument('--asan', help='Use Address Sanitizer', |
| 195 action='store_true') |
| 196 |
197 debug_group = parent_parser.add_mutually_exclusive_group() | 197 debug_group = parent_parser.add_mutually_exclusive_group() |
198 debug_group.add_argument('--debug', help='Debug build (default)', | 198 debug_group.add_argument('--debug', help='Debug build (default)', |
199 default=True, action='store_true') | 199 default=True, action='store_true') |
200 debug_group.add_argument('--release', help='Release build', default=False, | 200 debug_group.add_argument('--release', help='Release build', default=False, |
201 dest='debug', action='store_false') | 201 dest='debug', action='store_false') |
202 | 202 |
203 os_group = parent_parser.add_mutually_exclusive_group() | 203 os_group = parent_parser.add_mutually_exclusive_group() |
204 os_group.add_argument('--android', help='Build for Android', | 204 os_group.add_argument('--android', help='Build for Android', |
205 action='store_true') | 205 action='store_true') |
206 os_group.add_argument('--chromeos', help='Build for ChromeOS', | 206 os_group.add_argument('--chromeos', help='Build for ChromeOS', |
207 action='store_true') | 207 action='store_true') |
208 | 208 |
209 subparsers = parser.add_subparsers() | 209 subparsers = parser.add_subparsers() |
210 | 210 |
211 sync_parser = subparsers.add_parser('sync', parents=[parent_parser], | 211 sync_parser = subparsers.add_parser('sync', parents=[parent_parser], |
212 help='Sync using gclient (does not run gn).') | 212 help='Sync using gclient (does not run gn).') |
213 sync_parser.set_defaults(func=sync) | 213 sync_parser.set_defaults(func=sync) |
214 | 214 |
215 gn_parser = subparsers.add_parser('gn', parents=[parent_parser], | 215 gn_parser = subparsers.add_parser('gn', parents=[parent_parser], |
216 help='Run gn for mojo (does not sync).') | 216 help='Run gn for mojo (does not sync).') |
217 gn_parser.set_defaults(func=gn) | 217 gn_parser.set_defaults(func=gn) |
218 gn_parser.add_argument('--asan', help='Uses Address Sanitizer', | |
219 action='store_true') | |
220 gn_parser.add_argument('--with-dart', help='Configure the Dart bindings', | 218 gn_parser.add_argument('--with-dart', help='Configure the Dart bindings', |
221 action='store_true') | 219 action='store_true') |
222 clang_group = gn_parser.add_mutually_exclusive_group() | 220 clang_group = gn_parser.add_mutually_exclusive_group() |
223 clang_group.add_argument('--clang', help='Use Clang (default)', default=None, | 221 clang_group.add_argument('--clang', help='Use Clang (default)', default=None, |
224 action='store_true') | 222 action='store_true') |
225 clang_group.add_argument('--gcc', help='Use GCC', | 223 clang_group.add_argument('--gcc', help='Use GCC', |
226 dest='clang', action='store_false') | 224 dest='clang', action='store_false') |
227 goma_group = gn_parser.add_mutually_exclusive_group() | 225 goma_group = gn_parser.add_mutually_exclusive_group() |
228 goma_group.add_argument('--goma', | 226 goma_group.add_argument('--goma', |
229 help='Use Goma (if $GOMA_DIR is set or $HOME/goma ' | 227 help='Use Goma (if $GOMA_DIR is set or $HOME/goma ' |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 help='Run Dart unit tests (does not build).') | 265 help='Run Dart unit tests (does not build).') |
268 darttest_parser.set_defaults(func=darttest) | 266 darttest_parser.set_defaults(func=darttest) |
269 | 267 |
270 args = parser.parse_args() | 268 args = parser.parse_args() |
271 config = _args_to_config(args) | 269 config = _args_to_config(args) |
272 return args.func(config) | 270 return args.func(config) |
273 | 271 |
274 | 272 |
275 if __name__ == '__main__': | 273 if __name__ == '__main__': |
276 sys.exit(main()) | 274 sys.exit(main()) |
OLD | NEW |