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 To dispatch, performs the following steps: | 7 To dispatch, 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 def TagTestRunResults(test_run_results): | 151 def TagTestRunResults(test_run_results): |
152 """Tags all results with the last 4 digits of the device id. | 152 """Tags all results with the last 4 digits of the device id. |
153 | 153 |
154 Used when replicating tests to distinguish the same tests run on different | 154 Used when replicating tests to distinguish the same tests run on different |
155 devices. We use a set to store test results, so the hash (generated from | 155 devices. We use a set to store test results, so the hash (generated from |
156 name and tag) must be unique to be considered different results. | 156 name and tag) must be unique to be considered different results. |
157 """ | 157 """ |
158 new_test_run_results = base_test_result.TestRunResults() | 158 new_test_run_results = base_test_result.TestRunResults() |
159 for test_result in test_run_results.GetAll(): | 159 for test_result in test_run_results.GetAll(): |
160 test_result.SetTag(runner.device[-4:]) | 160 test_result.SetName('%s_%s' % (runner.device[-4:], test_result.GetName())) |
161 new_test_run_results.AddResult(test_result) | 161 new_test_run_results.AddResult(test_result) |
162 return new_test_run_results | 162 return new_test_run_results |
163 | 163 |
164 for test in test_collection: | 164 for test in test_collection: |
165 watcher.Reset() | 165 watcher.Reset() |
166 try: | 166 try: |
167 if not android_commands.IsDeviceAttached(runner.device): | 167 if not android_commands.IsDeviceAttached(runner.device): |
168 # Device is unresponsive, stop handling tests on this device. | 168 # Device is unresponsive, stop handling tests on this device. |
169 msg = 'Device %s is unresponsive.' % runner.device | 169 msg = 'Device %s is unresponsive.' % runner.device |
170 logging.warning(msg) | 170 logging.warning(msg) |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 try: | 386 try: |
387 return _RunAllTests(runners, test_collection_factory, | 387 return _RunAllTests(runners, test_collection_factory, |
388 num_retries, test_timeout, tag_results_with_device) | 388 num_retries, test_timeout, tag_results_with_device) |
389 finally: | 389 finally: |
390 try: | 390 try: |
391 _TearDownRunners(runners, setup_timeout) | 391 _TearDownRunners(runners, setup_timeout) |
392 except android_commands.errors.DeviceUnresponsiveError as e: | 392 except android_commands.errors.DeviceUnresponsiveError as e: |
393 logging.warning('Device unresponsive during TearDown: [%s]', e) | 393 logging.warning('Device unresponsive during TearDown: [%s]', e) |
394 finally: | 394 finally: |
395 forwarder.Forwarder.KillHost(build_type) | 395 forwarder.Forwarder.KillHost(build_type) |
OLD | NEW |