ExecutableBaseTest

public abstract class ExecutableBaseTest
extends Object implements IRemoteTest, IRuntimeHintProvider, ITestCollector, IShardableTest, IAbiReceiver

java.lang.Object
   ↳ com.android.tradefed.testtype.binary.ExecutableBaseTest


Base class for executable style of tests. For example: binaries, shell scripts.

Summary

Fields

public static final String NO_BINARY_ERROR

Public constructors

ExecutableBaseTest()

Public methods

abstract String findBinary(String binary)

Search for the binary to be able to run it.

IAbi getAbi()

final long getRuntimeHint()

Return the expected runtime of the test in milliseconds.

final void run(ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

abstract void runBinary(String binaryPath, ITestInvocationListener listener, TestDescription description)

Actually run the binary at the given path.

final void setAbi(IAbi abi)

final void setCollectTestsOnly(boolean shouldCollectTest)

Enables or disables test collection mode

final split()

Shard the test into separately runnable chunks.

Fields

NO_BINARY_ERROR

public static final String NO_BINARY_ERROR

Public constructors

ExecutableBaseTest

public ExecutableBaseTest ()

Public methods

findBinary

public abstract String findBinary (String binary)

Search for the binary to be able to run it.

Parameters
binary String: the path of the binary or simply the binary name.

Returns
String The path to the binary, or null if not found.

getAbi

public IAbi getAbi ()

Returns
IAbi

getRuntimeHint

public final long getRuntimeHint ()

Return the expected runtime of the test in milliseconds. The time is used to load balance sharded execution

Returns
long

run

public final void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results

Throws
DeviceNotAvailableException

runBinary

public abstract void runBinary (String binaryPath, 
                ITestInvocationListener listener, 
                TestDescription description)

Actually run the binary at the given path.

Parameters
binaryPath String: The path of the binary.

listener ITestInvocationListener: The listener where to report the results.

description TestDescription: The test in progress.

Throws
DeviceNotAvailableException

setAbi

public final void setAbi (IAbi abi)

Parameters
abi IAbi

setCollectTestsOnly

public final void setCollectTestsOnly (boolean shouldCollectTest)

Enables or disables test collection mode

split

public final  split ()

Shard the test into separately runnable chunks.

This must be deterministic and always return the same list of IRemoteTests for the same input.

This will be called before test execution, so injected dependencies (such as the ITestDevice for IDeviceTests) may be null.

Returns
a collection of subtests to be executed separately or null if test is not currently shardable