OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from pylib.base import base_test_sharder |
| 6 |
| 7 import test_runner |
| 8 |
| 9 class TestSharder(base_test_sharder.BaseTestSharder): |
| 10 """Responsible for sharding the tests on the connected devices.""" |
| 11 |
| 12 def __init__(self, attached_devices, test_suite, gtest_filter, |
| 13 test_arguments, timeout, cleanup_test_files, tool, |
| 14 build_type): |
| 15 super(TestSharder, self).__init__(attached_devices, build_type) |
| 16 self.test_suite = test_suite |
| 17 self.gtest_filter = gtest_filter or '' |
| 18 self.test_arguments = test_arguments |
| 19 self.timeout = timeout |
| 20 self.cleanup_test_files = cleanup_test_files |
| 21 self.tool = tool |
| 22 self.all_tests = [] |
| 23 if not self.gtest_filter: |
| 24 # TODO(nileshagrawal): Add support to get all the tests. |
| 25 raise Exception('You have not specified a test filter.') |
| 26 self.tests = self.all_tests |
| 27 |
| 28 def CreateShardedTestRunner(self, device, index): |
| 29 """Creates a suite-specific test runner. |
| 30 |
| 31 Args: |
| 32 device: Device serial where this shard will run. |
| 33 index: Index of this device in the pool. |
| 34 |
| 35 Returns: |
| 36 A TestRunner object. |
| 37 """ |
| 38 test_filter = self.gtest_filter |
| 39 return test_runner.TestRunner( |
| 40 device, |
| 41 self.test_suite, |
| 42 test_filter, |
| 43 self.test_arguments, |
| 44 self.timeout, |
| 45 self.cleanup_test_files, self.tool, index, |
| 46 self.build_type) |
OLD | NEW |