OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 tests, either sharding or replicating them. | 5 """Dispatches tests, either sharding or replicating them. |
6 | 6 |
7 Performs the following steps: | 7 Performs the following steps: |
8 * Create a test collection factory, using the given tests | 8 * Create a test collection factory, using the given tests |
9 - If sharding: test collection factory returns the same shared test collection | 9 - If sharding: test collection factory returns the same shared test collection |
10 to all test runners | 10 to all test runners |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 workers.StartAll() | 265 workers.StartAll() |
266 | 266 |
267 # Catch DeviceUnreachableErrors and set a warning exit code | 267 # Catch DeviceUnreachableErrors and set a warning exit code |
268 try: | 268 try: |
269 workers.JoinAll(watcher) | 269 workers.JoinAll(watcher) |
270 except (device_errors.DeviceUnreachableError, | 270 except (device_errors.DeviceUnreachableError, |
271 # TODO(jbudorick) Remove this once the underlying implementations | 271 # TODO(jbudorick) Remove this once the underlying implementations |
272 # for the above are switched or wrapped. | 272 # for the above are switched or wrapped. |
273 android_commands.errors.DeviceUnresponsiveError) as e: | 273 android_commands.errors.DeviceUnresponsiveError) as e: |
274 logging.error(e) | 274 logging.error(e) |
275 exit_code = constants.WARNING_EXIT_CODE | |
276 | 275 |
277 if not all((len(tc) == 0 for tc in test_collections)): | 276 if not all((len(tc) == 0 for tc in test_collections)): |
278 logging.error('Only ran %d tests (all devices are likely offline).' % | 277 logging.error('Only ran %d tests (all devices are likely offline).' % |
279 len(results)) | 278 len(results)) |
280 for tc in test_collections: | 279 for tc in test_collections: |
281 run_results.AddResults(base_test_result.BaseTestResult( | 280 run_results.AddResults(base_test_result.BaseTestResult( |
282 t, base_test_result.ResultType.UNKNOWN) for t in tc.test_names()) | 281 t, base_test_result.ResultType.UNKNOWN) for t in tc.test_names()) |
283 | 282 |
284 for r in results: | 283 for r in results: |
285 run_results.AddTestRunResults(r) | 284 run_results.AddTestRunResults(r) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 finally: | 404 finally: |
406 try: | 405 try: |
407 _TearDownRunners(runners, setup_timeout) | 406 _TearDownRunners(runners, setup_timeout) |
408 except (device_errors.DeviceUnreachableError, | 407 except (device_errors.DeviceUnreachableError, |
409 # TODO(jbudorick) Remove this once the underlying implementations | 408 # TODO(jbudorick) Remove this once the underlying implementations |
410 # for the above are switched or wrapped. | 409 # for the above are switched or wrapped. |
411 android_commands.errors.DeviceUnresponsiveError) as e: | 410 android_commands.errors.DeviceUnresponsiveError) as e: |
412 logging.warning('Device unresponsive during TearDown: [%s]', e) | 411 logging.warning('Device unresponsive during TearDown: [%s]', e) |
413 except Exception as e: | 412 except Exception as e: |
414 logging.error('Unexpected exception caught during TearDown: %s' % str(e)) | 413 logging.error('Unexpected exception caught during TearDown: %s' % str(e)) |
OLD | NEW |