KernelTargetTest

public class KernelTargetTest
extends ExecutableTargetTest

java.lang.Object
com.android.tradefed.testtype.binary.ExecutableBaseTest
  com.android.tradefed.testtype.binary.ExecutableTargetTest
    com.android.tradefed.testtype.binary.KernelTargetTest


用于在目标上运行可执行文件并解析内核测试结果的测试运行程序。

摘要

公共构造函数

KernelTargetTest()

公共方法

boolean compareKernelVersion(String minKernelVersion)

检查内核版本是否达到或超过此测试的最低内核版本。

String findBinary(String binary)

跳过 findBinary 中的二进制文件检查。

Integer getDeviceKernelVersion()

使用 uname -r 获取设备内核版本。

Integer parseKernelVersion(String version)

从 版本字符串中解析内核版本、主要修订版本以及(可选)最低修订版本,并将其转换为可用于数值比较的单个整数。

void run(TestInformation testInfo, ITestInvocationListener listener)

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

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

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

受保护的方法

void checkCommandResult(CommandResult result, ITestInvocationListener listener, TestDescription description)

检查测试命令的结果。

boolean doesRunBinaryGenerateTestResults()

公共构造函数

KernelTargetTest

public KernelTargetTest ()

公共方法

compareKernelVersion

public boolean compareKernelVersion (String minKernelVersion)

检查内核版本是否达到或超过此测试的最低内核版本。

参数
minKernelVersion String:配置中的最低版本字符串。

返回
boolean

findBinary

public String findBinary (String binary)

跳过 findBinary 中的二进制文件检查。与 mSkipBinaryCheck 冗余,但为了保持 向后兼容性而需要。

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

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

抛出
DeviceNotAvailableException

getDeviceKernelVersion

public Integer getDeviceKernelVersion ()

使用 uname -r 获取设备内核版本。

返回
Integer

抛出
DeviceNotAvailableException

parseKernelVersion

public Integer parseKernelVersion (String version)

从 版本字符串中解析内核版本、主要修订版本以及(可选)最低修订版本,并将其转换为可用于数值比较的单个整数。

参数
version String:Linux 版本字符串。

返回
Integer

run

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

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

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

listener ITestInvocationListener:测试结果的 ITestInvocationListener

抛出
DeviceNotAvailableException

runBinary

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

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

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

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

description TestDescription:正在进行的测试。

抛出
DeviceNotAvailableException
IOException

受保护的方法

checkCommandResult

protected void checkCommandResult (CommandResult result, 
                ITestInvocationListener listener, 
                TestDescription description)

检查测试命令的结果。

参数
result CommandResult:命令 CommandResult 的测试结果

listener ITestInvocationListenerITestInvocationListener

description TestDescription:正在进行的测试。

doesRunBinaryGenerateTestResults

protected boolean doesRunBinaryGenerateTestResults ()

返回
boolean