ArtRunTest

public class ArtRunTest
extends Object implements IAbiReceiver, IConfigurationReceiver, IRemoteTest, ITestCollector, ITestFilterReceiver

java.lang.Object
   ↳ com.android.tradefed.testtype.ArtRunTest


用于运行 ART 运行测试的测试运行程序。

摘要

嵌套类

class ArtRunTest.AdbShellCommandException

用于报告在执行 ADB shell 命令期间发生的错误的异常类。 

常量

String CHECKER_PAR_FILENAME

字段

public static final Boolean RUN_CHECKER

公共构造函数

ArtRunTest()

公共方法

void addAllExcludeFilters( filters)

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

void addAllIncludeFilters( filters)

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

void addExcludeFilter(String filter)

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

void addIncludeFilter(String filter)

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

void clearExcludeFilters()

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

void clearIncludeFilters()

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

IAbi getAbi()
getExcludeFilters()

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

getIncludeFilters()

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

void run(TestInformation testInfo, ITestInvocationListener listener)

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

void setAbi(IAbi abi)

void setCollectTestsOnly(boolean shouldCollectTest)

启用或停用测试收集模式

void setConfiguration(IConfiguration configuration)

注入正在使用的 IConfiguration

受保护的方法

checkExitCode(Integer exitCode)

检查测试命令返回的退出代码。

checkTestOutput(TestInformation testInfo, String actualOutputText, String outputShortName, String outputPrettyName)

检查测试命令生成的输出。

File createTestLocalTempDirectory(TestInformation testInfo)

在测试的依赖项文件夹中创建一个本地临时目录,以收集从被测设备拉取的测试输出。

executeCheckerTest(TestInformation testInfo, ITestInvocationListener listener)

执行检查器测试并检查其输出。

void extractSourcesFromJar(File tmpCheckerLocalDir, File jar)

将指定 jar 文件中的 src 目录提取到指定目录。

File getCheckerBinaryPath(TestInformation testInfo)

找到检查器二进制文件(Python 归档文件)。

runChecker(String[] checkerCommandLine)

运行检查器命令并检查其结果。

常量

CHECKER_PAR_FILENAME

public static final String CHECKER_PAR_FILENAME

常量值: "art-run-test-checker"

字段

RUN_CHECKER

public static final Boolean RUN_CHECKER

公共构造函数

ArtRunTest

public ArtRunTest ()

公共方法

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

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

getAbi

public IAbi getAbi ()

返回
IAbi

getExcludeFilters

public  getExcludeFilters ()

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

返回

getIncludeFilters

public  getIncludeFilters ()

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

返回

得分

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

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

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

listener ITestInvocationListener:测试结果的 ITestInvocationListener

抛出
DeviceNotAvailableException

setAbi

public void setAbi (IAbi abi)

参数
abi IAbi

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

启用或停用测试收集模式

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入正在使用的 IConfiguration

参数
configuration IConfiguration

受保护的方法

checkExitCode

protected  checkExitCode (Integer exitCode)

检查测试命令返回的退出代码。

参数
exitCode Integer:测试命令返回的退出代码

返回
可选的错误消息,如果测试退出代码表明成功,则为空

checkTestOutput

protected  checkTestOutput (TestInformation testInfo, 
                String actualOutputText, 
                String outputShortName, 
                String outputPrettyName)

检查测试命令生成的输出。

用于检查测试的标准输出和标准错误。

参数
testInfo TestInformation:与已执行测试关联的 TestInformation 对象

actualOutputText String:测试产生的输出

outputShortName String:输出渠道的短名称

outputPrettyName String:输出渠道的更美观的名称,用于错误消息

返回
可选的错误消息,如果检查的输出有效,则为空

createTestLocalTempDirectory

protected File createTestLocalTempDirectory (TestInformation testInfo)

在测试的依赖项文件夹中创建一个本地临时目录,以收集从被测设备拉取的测试输出。

参数
testInfo TestInformation:与已执行测试关联的 TestInformation 对象

返回
File 指向所创建临时目录的 ERROR(/File) 对象。

抛出
如果临时目录的创建失败。

executeCheckerTest

protected  executeCheckerTest (TestInformation testInfo, 
                ITestInvocationListener listener)

执行检查器测试并检查其输出。

检查器测试是包含在某些 ART 运行测试中的额外测试,以注释的形式写入测试源文件的注释中,用于验证 ART 的编译器。

参数
testInfo TestInformation:与已执行测试关联的 TestInformation 对象

listener ITestInvocationListener:与已执行测试关联的 ITestInvocationListener 对象

返回
可选的错误消息,如果检查器测试成功,则为空

抛出
ArtRunTest.AdbShellCommandException
DeviceNotAvailableException

extractSourcesFromJar

protected void extractSourcesFromJar (File tmpCheckerLocalDir, 
                File jar)

将指定 jar 文件中的 src 目录提取到指定目录。

参数
tmpCheckerLocalDir File

jar File

getCheckerBinaryPath

protected File getCheckerBinaryPath (TestInformation testInfo)

找到检查器二进制文件(Python 归档文件)。

参数
testInfo TestInformation

返回
File

runChecker

protected  runChecker (String[] checkerCommandLine)

运行检查器命令并检查其结果。

参数
checkerCommandLine String:要执行的检查器命令行

返回
可选的错误消息,如果检查器调用成功,则为空