| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Dispatches GTests.""" | 5 """Dispatches GTests.""" |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 import fnmatch | 8 import fnmatch |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 If options.use_emulator is True, all tests will be run in new emulator | 206 If options.use_emulator is True, all tests will be run in new emulator |
| 207 instance. | 207 instance. |
| 208 | 208 |
| 209 Args: | 209 Args: |
| 210 options: options for running the tests. | 210 options: options for running the tests. |
| 211 | 211 |
| 212 Returns: | 212 Returns: |
| 213 base_test_result.TestRunResults object with the results of running the tests | 213 base_test_result.TestRunResults object with the results of running the tests |
| 214 """ | 214 """ |
| 215 results = base_test_result.TestRunResults() |
| 216 |
| 215 if options.test_suite == 'help': | 217 if options.test_suite == 'help': |
| 216 _ListTestSuites() | 218 _ListTestSuites() |
| 217 return 0 | 219 return (results, 0) |
| 218 | 220 |
| 219 if options.use_xvfb: | 221 if options.use_xvfb: |
| 220 framebuffer = xvfb.Xvfb() | 222 framebuffer = xvfb.Xvfb() |
| 221 framebuffer.Start() | 223 framebuffer.Start() |
| 222 | 224 |
| 223 all_test_suites = _FullyQualifiedTestSuites(options.exe, options.test_suite, | 225 all_test_suites = _FullyQualifiedTestSuites(options.exe, options.test_suite, |
| 224 options.build_type) | 226 options.build_type) |
| 225 results = base_test_result.TestRunResults() | |
| 226 exit_code = 0 | 227 exit_code = 0 |
| 227 for suite_name, suite_path in all_test_suites: | 228 for suite_name, suite_path in all_test_suites: |
| 228 # Give each test suite its own copy of options. | 229 # Give each test suite its own copy of options. |
| 229 test_options = copy.deepcopy(options) | 230 test_options = copy.deepcopy(options) |
| 230 test_options.test_suite = suite_path | 231 test_options.test_suite = suite_path |
| 231 test_results, test_exit_code = _RunATestSuite(test_options, suite_name) | 232 test_results, test_exit_code = _RunATestSuite(test_options, suite_name) |
| 232 results.AddTestRunResults(test_results) | 233 results.AddTestRunResults(test_results) |
| 233 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: | 234 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: |
| 234 exit_code = test_exit_code | 235 exit_code = test_exit_code |
| 235 | 236 |
| 236 if options.use_xvfb: | 237 if options.use_xvfb: |
| 237 framebuffer.Stop() | 238 framebuffer.Stop() |
| 238 | 239 |
| 239 return (results, exit_code) | 240 return (results, exit_code) |
| OLD | NEW |