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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 'ensure_start'] | 105 'ensure_start'] |
106 exit_code = subprocess.call(command) | 106 exit_code = subprocess.call(command) |
107 if exit_code: | 107 if exit_code: |
108 return exit_code | 108 return exit_code |
109 | 109 |
110 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir]) | 110 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir]) |
111 else: | 111 else: |
112 return subprocess.call(['ninja', '-C', out_dir]) | 112 return subprocess.call(['ninja', '-C', out_dir]) |
113 | 113 |
114 | 114 |
| 115 def dartcheck(config): |
| 116 """Runs the dart analyzer on code for the given config.""" |
| 117 |
| 118 out_dir = _get_out_dir(config) |
| 119 print 'Checking dart code in %s ...' % out_dir |
| 120 return subprocess.call(['ninja', '-C', out_dir, 'dartcheck']) |
| 121 |
| 122 |
115 def _run_tests(config, test_types): | 123 def _run_tests(config, test_types): |
116 """Runs the tests of the given type(s) for the given config.""" | 124 """Runs the tests of the given type(s) for the given config.""" |
117 | 125 |
118 assert isinstance(test_types, list) | 126 assert isinstance(test_types, list) |
119 config = deepcopy(config) | 127 config = deepcopy(config) |
120 config.values['test_types'] = test_types | 128 config.values['test_types'] = test_types |
121 | 129 |
122 test_list = GetTestList(config) | 130 test_list = GetTestList(config) |
123 dry_run = config.values.get('dry_run') | 131 dry_run = config.values.get('dry_run') |
124 final_exit_code = 0 | 132 final_exit_code = 0 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 perftest_parser.set_defaults(func=perftest) | 245 perftest_parser.set_defaults(func=perftest) |
238 | 246 |
239 pytest_parser = subparsers.add_parser('pytest', parents=[parent_parser], | 247 pytest_parser = subparsers.add_parser('pytest', parents=[parent_parser], |
240 help='Run Python unit tests (does not build).') | 248 help='Run Python unit tests (does not build).') |
241 pytest_parser.set_defaults(func=pytest) | 249 pytest_parser.set_defaults(func=pytest) |
242 | 250 |
243 nacltest_parser = subparsers.add_parser('nacltest', parents=[parent_parser], | 251 nacltest_parser = subparsers.add_parser('nacltest', parents=[parent_parser], |
244 help='Run NaCl unit tests (does not build).') | 252 help='Run NaCl unit tests (does not build).') |
245 nacltest_parser.set_defaults(func=nacltest) | 253 nacltest_parser.set_defaults(func=nacltest) |
246 | 254 |
| 255 dartcheck_parser = subparsers.add_parser('dartcheck', parents=[parent_parser], |
| 256 help='Run the dart source code analyzer to check for warnings.') |
| 257 dartcheck_parser.set_defaults(func=dartcheck) |
| 258 |
247 args = parser.parse_args() | 259 args = parser.parse_args() |
248 config = _args_to_config(args) | 260 config = _args_to_config(args) |
249 return args.func(config) | 261 return args.func(config) |
250 | 262 |
251 | 263 |
252 if __name__ == '__main__': | 264 if __name__ == '__main__': |
253 sys.exit(main()) | 265 sys.exit(main()) |
OLD | NEW |