ExecutableBaseTest

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

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

void addAllExcludeFilters( filters)

Adds the ERROR(/Set) of filters of which tests to exclude.

void addAllIncludeFilters( filters)

Adds the ERROR(/Set) of filters of which tests to include.

void addExcludeFilter(String filter)

Adds a filter of which tests to exclude.

void addIncludeFilter(String filter)

Adds a filter of which tests to include.

void clearExcludeFilters()

Delete all the exclude filters currently tracked.

void clearIncludeFilters()

Delete all the include filters currently tracked.

abstract String findBinary(String binary)

Search for the binary to be able to run it.

IAbi getAbi()

boolean getCollectTestsOnly()
getExcludeFilters()

Returns the current ERROR(/Set) of exclude filters.

getIncludeFilters()

Returns the current ERROR(/Set) of include filters.

final long getRuntimeHint()

Return the expected runtime of the test in milliseconds.

reportDependencies()
void run(TestInformation testInfo, 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(int shardHint)

Alternative version of split() which also provides the shardCount that is attempted to be run.

Protected methods

boolean doesRunBinaryGenerateTestResults()
TestDescription[] getFilterDescriptions( testCommands)
String getModuleId(IInvocationContext context)
long getTimeoutPerBinaryMs()

Fields

NO_BINARY_ERROR

public static final String NO_BINARY_ERROR

Public constructors

ExecutableBaseTest

public ExecutableBaseTest ()

Public methods

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

Adds the ERROR(/Set) of filters of which tests to exclude.

Parameters
filters

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

Adds the ERROR(/Set) of filters of which tests to include.

Parameters
filters

addExcludeFilter

public void addExcludeFilter (String filter)

Adds a filter of which tests to exclude.

Parameters
filter String

addIncludeFilter

public void addIncludeFilter (String filter)

Adds a filter of which tests to include.

Parameters
filter String

clearExcludeFilters

public void clearExcludeFilters ()

Delete all the exclude filters currently tracked.

clearIncludeFilters

public void clearIncludeFilters ()

Delete all the include filters currently tracked.

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.

Throws
DeviceNotAvailableException

getAbi

public IAbi getAbi ()

Returns
IAbi

getCollectTestsOnly

public boolean getCollectTestsOnly ()

Returns
boolean

getExcludeFilters

public  getExcludeFilters ()

Returns the current ERROR(/Set) of exclude filters.

Returns

getIncludeFilters

public  getIncludeFilters ()

Returns the current ERROR(/Set) of include filters.

Returns

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

reportDependencies

public  reportDependencies ()

Returns

run

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
testInfo TestInformation: The TestInformation object containing useful information to run tests.

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 (int shardHint)

Alternative version of split() which also provides the shardCount that is attempted to be run. This is useful for some test runner that cannot arbitrarily decide sometimes.

Parameters
shardHint int: the attempted shard count.

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

Protected methods

doesRunBinaryGenerateTestResults

protected boolean doesRunBinaryGenerateTestResults ()

Returns
boolean

getFilterDescriptions

protected TestDescription[] getFilterDescriptions ( testCommands)

Parameters
testCommands

Returns
TestDescription[]

getModuleId

protected String getModuleId (IInvocationContext context)

Parameters
context IInvocationContext

Returns
String

getTimeoutPerBinaryMs

protected long getTimeoutPerBinaryMs ()

Returns
long the timeout applied to each binary for their execution.