| 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 |
| 11 from pylib import sharded_tests_queue | 11 from pylib.base import sharded_tests_queue |
| 12 from pylib.base.test_result import TestResults |
| 12 from pylib.instrumentation.run_java_tests import FatalTestException | 13 from pylib.instrumentation.run_java_tests import FatalTestException |
| 13 from pylib.test_result import TestResults | |
| 14 | 14 |
| 15 from python_test_caller import CallPythonTest | 15 from python_test_caller import CallPythonTest |
| 16 | 16 |
| 17 | 17 |
| 18 def SetTestsContainer(tests_container): | 18 def SetTestsContainer(tests_container): |
| 19 """Sets PythonTestSharder as a top-level field. | 19 """Sets PythonTestSharder as a top-level field. |
| 20 | 20 |
| 21 PythonTestSharder uses multiprocessing.Pool, which creates a pool of | 21 PythonTestSharder uses multiprocessing.Pool, which creates a pool of |
| 22 processes. This is used to initialize each worker in the pool, ensuring that | 22 processes. This is used to initialize each worker in the pool, ensuring that |
| 23 each worker has access to this shared pool of tests. | 23 each worker has access to this shared pool of tests. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 failed_tests: a list of SingleTestResults representing failed tests. | 195 failed_tests: a list of SingleTestResults representing failed tests. |
| 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_tests, or an empty list if there is no correspondence. | 199 failed_tests, or an empty list if there is no correspondence. |
| 200 """ | 200 """ |
| 201 failed_test_names = map(lambda t: t.test_name, failed_tests) | 201 failed_test_names = map(lambda t: t.test_name, failed_tests) |
| 202 tests_to_retry = [t for t in available_tests | 202 tests_to_retry = [t for t in available_tests |
| 203 if t.qualified_name in failed_test_names] | 203 if t.qualified_name in failed_test_names] |
| 204 return tests_to_retry | 204 return tests_to_retry |
| OLD | NEW |