StrictShardHelper

public class StrictShardHelper
extends ShardHelper

java.lang.Object
   ↳ com.android.tradefed.invoker.shard.ShardHelper
     ↳ com.android.tradefed.invoker.shard.StrictShardHelper


Sharding strategy to create strict shards that do not report together,

Summary

Public constructors

StrictShardHelper()

Public methods

boolean shardConfig(IConfiguration config, TestInformation testInfo, IRescheduler rescheduler, ITestLogger logger)

Attempt to shard the configuration into sub-configurations, to be re-scheduled to run on multiple resources in parallel.

Protected methods

splitTests( fullList, int shardCount)

Split the list of tests to run however the implementation see fit.

Public constructors

StrictShardHelper

public StrictShardHelper ()

Public methods

shardConfig

public boolean shardConfig (IConfiguration config, 
                TestInformation testInfo, 
                IRescheduler rescheduler, 
                ITestLogger logger)

Attempt to shard the configuration into sub-configurations, to be re-scheduled to run on multiple resources in parallel.

A successful shard action renders the current config empty, and invocation should not proceed.

Parameters
config IConfiguration: the current IConfiguration.

testInfo TestInformation: the TestInformation holding the tests information.

rescheduler IRescheduler: the IRescheduler

logger ITestLogger

Returns
boolean true if test was sharded. Otherwise return false

Protected methods

splitTests

protected  splitTests ( fullList, 
                int shardCount)

Split the list of tests to run however the implementation see fit. Sharding needs to be consistent. It is acceptable to return an empty list if no tests can be run in the shard.

Implement this in order to provide a test suite specific sharding. The default implementation attempts to balance the number of IRemoteTest per shards as much as possible as a first step, then use a minor criteria or run-hint to adjust the lists a bit more.

Parameters
fullList : the initial full list of IRemoteTest containing all the tests that need to run.

shardCount int: the total number of shard that need to run.

Returns
a list of list IRemoteTests that have been assigned to each shard. The list size will be the shardCount.