ExecutableBaseTest

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

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


可执行样式测试的基类。例如:二进制文件、shell 脚本。

摘要

常量

String NO_BINARY_ERROR

公共构造函数

ExecutableBaseTest()

公共方法

void addAllExcludeFilters( filters)

添加了要排除的测试的过滤条件的 ERROR(/Set)

void addAllIncludeFilters( filters)

添加了要包含的测试的过滤条件 ERROR(/Set)

void addExcludeFilter(String filter)

添加了要排除的测试的过滤条件。

void addIncludeFilter(String filter)

添加了用于指定要包含哪些测试的过滤条件。

void clearExcludeFilters()

删除当前跟踪的所有排除过滤条件。

void clearIncludeFilters()

删除当前跟踪的所有包含过滤条件。

abstract String findBinary(String binary)

搜索二进制文件,以便能够运行它。

IAbi getAbi()

boolean getCollectTestsOnly()
getExcludeFilters()

返回排除过滤条件的当前 ERROR(/Set)

getIncludeFilters()

返回包含过滤器的当前 ERROR(/Set)

final long getRuntimeHint()

以毫秒为单位返回测试的预期运行时长。

reportDependencies()
void run(TestInformation testInfo, ITestInvocationListener listener)

运行测试,并将结果报告给监听器。

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

实际运行给定路径中的二进制文件。

final void setAbi(IAbi abi)

final void setCollectTestsOnly(boolean shouldCollectTest)

启用或停用测试收集模式

void setConfiguration(IConfiguration configuration)

注入正在使用的 IConfiguration

FailureDescription shouldAbortRun(TestDescription description)

检查 testRun 是否应提前结束。

final split(int shardHint)

split() 的替代版本,还提供尝试运行的 shardCount。

受保护的方法

boolean doesRunBinaryGenerateTestResults()
boolean doesRunBinaryGenerateTestRuns()
getAllTestCommands()

将 mBinaryPaths 转换为 mTestCommands,以保持一致性。

IConfiguration getConfiguration()

返回测试配置。

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

常量

NO_BINARY_ERROR

public static final String NO_BINARY_ERROR

常量值: "二进制文件 %s 不存在。"

公共构造函数

ExecutableBaseTest

public ExecutableBaseTest ()

公共方法

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

添加了要排除的测试的过滤条件的 ERROR(/Set)

参数
filters

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

添加了要包含的测试的过滤条件 ERROR(/Set)

参数
filters

addExcludeFilter

public void addExcludeFilter (String filter)

添加了要排除的测试的过滤条件。

参数
filter String

addIncludeFilter

public void addIncludeFilter (String filter)

添加了用于指定要包含哪些测试的过滤条件。

参数
filter String

clearExcludeFilters

public void clearExcludeFilters ()

删除当前跟踪的所有排除过滤条件。

clearIncludeFilters

public void clearIncludeFilters ()

删除当前跟踪的所有包含过滤条件。

findBinary

public abstract String findBinary (String binary)

搜索二进制文件,以便能够运行它。

参数
binary String:二进制文件的路径或仅为二进制文件名称。

返回
String 二进制文件的路径,如果未找到,则为 null。

抛出
DeviceNotAvailableException

getAbi

public IAbi getAbi ()

返回
IAbi

getCollectTestsOnly

public boolean getCollectTestsOnly ()

返回
boolean

getExcludeFilters

public  getExcludeFilters ()

返回排除过滤条件的当前 ERROR(/Set)

返回

getIncludeFilters

public  getIncludeFilters ()

返回包含过滤器的当前 ERROR(/Set)

返回

getRuntimeHint

public final long getRuntimeHint ()

以毫秒为单位返回测试的预期运行时长。 该时间用于对分片执行进行负载均衡

返回
long

reportDependencies

public  reportDependencies ()

返回

得分

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

运行测试,并将结果报告给监听器。

参数
testInfo TestInformation:包含用于运行测试的实用信息的 TestInformation 对象。

listener ITestInvocationListener:测试结果的 ITestInvocationListener

抛出
DeviceNotAvailableException

runBinary

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

实际运行给定路径中的二进制文件。

参数
binaryPath String:二进制文件的路径。

listener ITestInvocationListener:用于报告结果的监听器。

description TestDescription:正在进行的测试。

抛出
DeviceNotAvailableException

setAbi

public final void setAbi (IAbi abi)

参数
abi IAbi

setCollectTestsOnly

public final void setCollectTestsOnly (boolean shouldCollectTest)

启用或停用测试收集模式

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入正在使用的 IConfiguration

参数
configuration IConfiguration

shouldAbortRun

public FailureDescription shouldAbortRun (TestDescription description)

检查 testRun 是否应提前结束。

参数
description TestDescription:正在进行的测试。

返回
FailureDescription 如果运行循环应终止,则为 FailureDescription。

分解

public final  split (int shardHint)

split() 的替代版本,还提供尝试运行的 shardCount。这对于有时无法任意决定的某些测试运行程序非常有用。

参数
shardHint int:尝试的分片数量。

返回
要单独执行的子测试集合,如果测试目前不可分片,则为 null

受保护的方法

doesRunBinaryGenerateTestResults

protected boolean doesRunBinaryGenerateTestResults ()

返回
boolean

doesRunBinaryGenerateTestRuns

protected boolean doesRunBinaryGenerateTestRuns ()

返回
boolean

getAllTestCommands

protected  getAllTestCommands ()

将 mBinaryPaths 转换为 mTestCommands,以保持一致性。

返回
testCommands 的 MapERROR(/LinkedHashMap)<string, string="">。

</string,>

getConfiguration

protected IConfiguration getConfiguration ()

返回测试配置。

返回
IConfiguration IConfiguration

getFilterDescriptions

protected TestDescription[] getFilterDescriptions ( testCommands)

参数
testCommands

返回
TestDescription[]

getModuleId

protected String getModuleId (IInvocationContext context)

参数
context IInvocationContext

返回
String

getTimeoutPerBinaryMs

protected long getTimeoutPerBinaryMs ()

返回
long 应用于每个二进制文件以供其执行的超时时间。

isTestFailed

protected boolean isTestFailed (String testName)

参数
testName String

返回
boolean