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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 raise device_errors.DeviceUnreachableError(msg) | 109 raise device_errors.DeviceUnreachableError(msg) |
110 result, retry = runner.RunTest(test.test) | 110 result, retry = runner.RunTest(test.test) |
111 if tag_results_with_device: | 111 if tag_results_with_device: |
112 result = TagTestRunResults(result) | 112 result = TagTestRunResults(result) |
113 test.tries += 1 | 113 test.tries += 1 |
114 if retry and test.tries <= num_retries: | 114 if retry and test.tries <= num_retries: |
115 # Retry non-passing results, only record passing results. | 115 # Retry non-passing results, only record passing results. |
116 pass_results = base_test_result.TestRunResults() | 116 pass_results = base_test_result.TestRunResults() |
117 pass_results.AddResults(result.GetPass()) | 117 pass_results.AddResults(result.GetPass()) |
118 out_results.append(pass_results) | 118 out_results.append(pass_results) |
119 logging.warning('Will retry test, try #%s.' % test.tries) | 119 logging.warning('Will retry test %s, try #%s.' % (repr(test.test), |
jbudorick
2015/02/28 02:26:52
This should be retry, not test.test. (test.test wo
boliu
2015/02/28 02:37:56
Done.
| |
120 test.tries)) | |
120 collection.add(_Test(test=retry, tries=test.tries)) | 121 collection.add(_Test(test=retry, tries=test.tries)) |
121 else: | 122 else: |
122 # All tests passed or retry limit reached. Either way, record results. | 123 # All tests passed or retry limit reached. Either way, record results. |
123 out_results.append(result) | 124 out_results.append(result) |
124 except: | 125 except: |
125 # An unhandleable exception, ensure tests get run by another device and | 126 # An unhandleable exception, ensure tests get run by another device and |
126 # reraise this exception on the main thread. | 127 # reraise this exception on the main thread. |
127 collection.add(test) | 128 collection.add(test) |
128 raise | 129 raise |
129 finally: | 130 finally: |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 finally: | 334 finally: |
334 try: | 335 try: |
335 _TearDownRunners(runners, setup_timeout) | 336 _TearDownRunners(runners, setup_timeout) |
336 except (device_errors.DeviceUnreachableError, | 337 except (device_errors.DeviceUnreachableError, |
337 # TODO(jbudorick) Remove this once the underlying implementations | 338 # TODO(jbudorick) Remove this once the underlying implementations |
338 # for the above are switched or wrapped. | 339 # for the above are switched or wrapped. |
339 android_commands.errors.DeviceUnresponsiveError) as e: | 340 android_commands.errors.DeviceUnresponsiveError) as e: |
340 logging.warning('Device unresponsive during TearDown: [%s]', e) | 341 logging.warning('Device unresponsive during TearDown: [%s]', e) |
341 except Exception as e: | 342 except Exception as e: |
342 logging.error('Unexpected exception caught during TearDown: %s' % str(e)) | 343 logging.error('Unexpected exception caught during TearDown: %s' % str(e)) |
OLD | NEW |