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 import constants |
| 6 from pylib.base import base_test_sharder |
| 7 from pylib.gtest 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, in_webkit_checkout): |
| 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 = '--single_process %s' % test_arguments |
| 19 self.timeout = timeout |
| 20 self.cleanup_test_files = cleanup_test_files |
| 21 self.tool = tool |
| 22 self.in_webkit_checkout = in_webkit_checkout |
| 23 self.all_tests = [] |
| 24 if not self.gtest_filter: |
| 25 # TODO(nileshagrawal): Add support to get all the tests. |
| 26 raise Exception('You have not specified a test filter.') |
| 27 self.tests = self.all_tests |
| 28 |
| 29 def CreateShardedTestRunner(self, device, index): |
| 30 """Creates a suite-specific test runner. |
| 31 |
| 32 Args: |
| 33 device: Device serial where this shard will run. |
| 34 index: Index of this device in the pool. |
| 35 |
| 36 Returns: |
| 37 A TestRunner object. |
| 38 """ |
| 39 test_filter = self.gtest_filter |
| 40 return test_runner.TestRunner( |
| 41 device, |
| 42 self.test_suite, |
| 43 self.gtest_filter, |
| 44 self.test_arguments, |
| 45 self.timeout, |
| 46 self.cleanup_test_files, |
| 47 self.tool, |
| 48 0, |
| 49 self.build_type, |
| 50 self.in_webkit_checkout, |
| 51 constants.BROWSERTEST_TEST_PACKAGE_NAME, |
| 52 constants.BROWSERTEST_TEST_ACTIVITY_NAME, |
| 53 constants.BROWSERTEST_COMMAND_LINE_FILE) |
OLD | NEW |