OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Takes care of sharding the python-drive tests in multiple devices.""" | 5 """Takes care of sharding the python-drive tests in multiple devices.""" |
6 | 6 |
7 import copy | 7 import copy |
8 import logging | 8 import logging |
9 import multiprocessing | 9 import multiprocessing |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 options: Options to use for setting up tests. | 88 options: Options to use for setting up tests. |
89 | 89 |
90 Returns: | 90 Returns: |
91 An aggregated list of test results. | 91 An aggregated list of test results. |
92 """ | 92 """ |
93 tests_container = None | 93 tests_container = None |
94 | 94 |
95 def __init__(self, attached_devices, available_tests, options): | 95 def __init__(self, attached_devices, available_tests, options): |
96 self.options = options | 96 self.options = options |
97 self.attached_devices = attached_devices | 97 self.attached_devices = attached_devices |
98 self.retries = options.shard_retries | 98 self.retries = options.num_retries |
99 self.tests = available_tests | 99 self.tests = available_tests |
100 | 100 |
101 def _SetupSharding(self, tests): | 101 def _SetupSharding(self, tests): |
102 """Creates the shared pool of tests and makes it available to test runners. | 102 """Creates the shared pool of tests and makes it available to test runners. |
103 | 103 |
104 Args: | 104 Args: |
105 tests: the list of tests which will be consumed by workers. | 105 tests: the list of tests which will be consumed by workers. |
106 """ | 106 """ |
107 SetTestsContainer(sharded_tests_queue.ShardedTestsQueue( | 107 SetTestsContainer(sharded_tests_queue.ShardedTestsQueue( |
108 len(self.attached_devices), tests)) | 108 len(self.attached_devices), tests)) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 available_tests: a list of tests which subclass PythonTestBase. | 194 available_tests: a list of tests which subclass PythonTestBase. |
195 failed_test_names: a list of failed test names. | 195 failed_test_names: a list of failed test names. |
196 | 196 |
197 Returns: | 197 Returns: |
198 A list of test objects which correspond to test names found in | 198 A list of test objects which correspond to test names found in |
199 failed_test_names, or an empty list if there is no correspondence. | 199 failed_test_names, or an empty list if there is no correspondence. |
200 """ | 200 """ |
201 tests_to_retry = [t for t in available_tests | 201 tests_to_retry = [t for t in available_tests |
202 if t.qualified_name in failed_test_names] | 202 if t.qualified_name in failed_test_names] |
203 return tests_to_retry | 203 return tests_to_retry |
OLD | NEW |