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: mojo/tools/mojob.py

Issue 913123004: Make mojob.py test print a summary at the end. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | no next file » | 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 # 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 def _run_tests(config, test_types): 115 def _run_tests(config, test_types):
116 """Runs the tests of the given type(s) for the given config.""" 116 """Runs the tests of the given type(s) for the given config."""
117 117
118 assert isinstance(test_types, list) 118 assert isinstance(test_types, list)
119 config = deepcopy(config) 119 config = deepcopy(config)
120 config.values['test_types'] = test_types 120 config.values['test_types'] = test_types
121 121
122 test_list = GetTestList(config) 122 test_list = GetTestList(config)
123 dry_run = config.values.get('dry_run') 123 dry_run = config.values.get('dry_run')
124 final_exit_code = 0 124 final_exit_code = 0
125 failure_list = []
125 for entry in test_list: 126 for entry in test_list:
126 print 'Running: %s' % entry['name'] 127 print 'Running: %s' % entry['name']
127 print 'Command: %s' % entry['command'] 128 print 'Command: %s' % entry['command']
128 if dry_run: 129 if dry_run:
129 continue 130 continue
130 131
131 exit_code = subprocess.call(entry['command']) 132 exit_code = subprocess.call(entry['command'])
132 if not final_exit_code: 133 if exit_code:
133 final_exit_code = exit_code 134 if not final_exit_code:
135 final_exit_code = exit_code
136 failure_list.append(entry['name'])
137
138 print 72 * '='
139 print 'SUMMARY:',
140 if dry_run:
141 print 'Dry run: no tests run'
142 elif not failure_list:
143 assert not final_exit_code
144 print 'All tests passed'
145 else:
146 assert final_exit_code
147 print 'The following had failures:', ', '.join(failure_list)
148
134 return final_exit_code 149 return final_exit_code
135 150
136 151
137 def test(config): 152 def test(config):
138 return _run_tests(config, [Config.TEST_TYPE_DEFAULT]) 153 return _run_tests(config, [Config.TEST_TYPE_DEFAULT])
139 154
140 155
141 def perftest(config): 156 def perftest(config):
142 return _run_tests(config, [Config.TEST_TYPE_PERF]) 157 return _run_tests(config, [Config.TEST_TYPE_PERF])
143 158
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 help='Run NaCl unit tests (does not build).') 252 help='Run NaCl unit tests (does not build).')
238 nacltest_parser.set_defaults(func=nacltest) 253 nacltest_parser.set_defaults(func=nacltest)
239 254
240 args = parser.parse_args() 255 args = parser.parse_args()
241 config = _args_to_config(args) 256 config = _args_to_config(args)
242 return args.func(config) 257 return args.func(config)
243 258
244 259
245 if __name__ == '__main__': 260 if __name__ == '__main__':
246 sys.exit(main()) 261 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698