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 """Sharder for the instrumentation tests.""" | |
6 | |
7 from pylib.base import base_test_sharder | |
8 from pylib.base import sharded_tests_queue | |
9 | |
10 import test_runner | |
11 | |
12 | |
13 class TestSharder(base_test_sharder.BaseTestSharder): | |
14 """Responsible for sharding the tests on the connected devices.""" | |
15 | |
16 def __init__(self, attached_devices, options, tests, apks): | |
17 super(TestSharder, self).__init__(attached_devices, | |
18 options.build_type) | |
19 self.options = options | |
20 self.tests = tests | |
21 self.apks = apks | |
22 | |
23 def SetupSharding(self, tests): | |
24 """Called before starting the shards.""" | |
25 base_test_sharder.SetTestsContainer(sharded_tests_queue.ShardedTestsQueue( | |
26 len(self.attached_devices), tests)) | |
27 | |
28 def CreateShardedTestRunner(self, device, index): | |
29 """Creates a sharded 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 return test_runner.TestRunner(self.options, device, None, False, index, | |
39 self.apks, []) | |
OLD | NEW |