内核目标测试
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 () |
公共构造函数
内核目标测试
public KernelTargetTest ()
公共方法
比较内核版本
public boolean compareKernelVersion (String minKernelVersion)
检查内核版本是否满足或超过此测试的最低内核版本。
参数 | |
---|---|
minKernelVersion | String :配置中的最低版本字符串。 |
退货 | |
---|---|
boolean |
查找二进制文件
public String findBinary (String binary)
跳过 findBinary 中的二进制检查。与 mSkipBinaryCheck 冗余,但需要向后兼容。
参数 | |
---|---|
binary | String :二进制文件的路径或简单的二进制文件名称。 |
退货 | |
---|---|
String | 二进制文件的路径,如果未找到则为 null。 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取设备内核版本
public Integer getDeviceKernelVersion ()
使用 uname -r 获取设备内核版本。
退货 | |
---|---|
Integer |
投掷 | |
---|---|
DeviceNotAvailableException |
解析内核版本
public Integer parseKernelVersion (String version)
将版本字符串中的内核版本、主要修订版和最小修订版(可选)解析为可用于数字比较的单个整数。
参数 | |
---|---|
version | String : Linux 版本字符串。 |
退货 | |
---|---|
Integer |
跑步
public void run (TestInformation testInfo, ITestInvocationListener listener)
运行测试,并将结果报告给侦听器。
参数 | |
---|---|
testInfo | TestInformation : TestInformation 对象包含运行测试的有用信息。 |
listener | ITestInvocationListener :测试结果的ITestInvocationListener |
投掷 | |
---|---|
DeviceNotAvailableException |
运行二进制文件
public void runBinary (String binaryPath, ITestInvocationListener listener, TestDescription description)
实际上在给定路径上运行二进制文件。
参数 | |
---|---|
binaryPath | String :二进制文件的路径。 |
listener | ITestInvocationListener :报告结果的侦听器。 |
description | TestDescription :测试正在进行中。 |
投掷 | |
---|---|
DeviceNotAvailableException |
受保护的方法
检查命令结果
protected void checkCommandResult (CommandResult result, ITestInvocationListener listener, TestDescription description)
检查测试命令的结果。
参数 | |
---|---|
result | CommandResult : 命令CommandResult 的测试结果 |
listener | ITestInvocationListener : ITestInvocationListener |
description | TestDescription :测试正在进行中。 |
doesRunBinary生成测试结果
protected boolean doesRunBinaryGenerateTestResults ()
退货 | |
---|---|
boolean |