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

得分

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

受保护的方法

checkCommandResult

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

检查测试命令的结果。

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

listener ITestInvocationListenerITestInvocationListener

description TestDescription:正在进行的测试。

doesRunBinaryGenerateTestResults

protected boolean doesRunBinaryGenerateTestResults ()

返回
boolean