GoogleBenchmarkTest

public class GoogleBenchmarkTest
extends Object implements IDeviceTest, IRemoteTest, ITestFilterReceiver

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


在给定设备上运行 Google 基准测试软件包的测试。

摘要

公共构造函数

GoogleBenchmarkTest()

公共方法

void addAllExcludeFilters(Set<String> filters)

添加用于指定要排除哪些测试的过滤条件Set

void addAllIncludeFilters(Set<String> filters)

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

void addExcludeFilter(String filter)

添加用于指定要排除哪些测试的过滤条件。

void addIncludeFilter(String filter)

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

void addModuleName(String moduleName)

添加要运行的 Android 原生基准测试模块。

String cleanFilter(String filter)
void clearExcludeFilters()

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

void clearIncludeFilters()

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

ITestDevice getDevice()

获取被测设备。

Set<String> getExcludeFilters()

返回当前的排除过滤条件Set

Set<String> getIncludeFilters()

返回当前的包含过滤条件Set

List<String> getModuleNames()

获取要运行的 Android 原生基准测试模块。

void run(TestInformation testInfo, ITestInvocationListener listener)

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

void setDevice(ITestDevice device)

注入被测设备。

void setReportRunName(String reportRunName)

受保护的方法

CommandResult executeCommand(ITestDevice testDevice, String cmd)

用于运行基准测试命令的辅助方法。

String getFilterFlagForFilters(Set<String> filters)
String getFilterFlagForTests(Set<String> fitlererTests)
boolean shouldSkipFile(String fullPath)

用于确定是否应跳过指定文件的执行的辅助方法。

公共构造函数

GoogleBenchmarkTest

public GoogleBenchmarkTest ()

公共方法

addAllExcludeFilters

public void addAllExcludeFilters (Set<String> filters)

添加用于指定要排除哪些测试的过滤条件Set

参数
filters Set

addAllIncludeFilters

public void addAllIncludeFilters (Set<String> filters)

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

参数
filters Set

addExcludeFilter

public void addExcludeFilter (String filter)

添加用于指定要排除哪些测试的过滤条件。

参数
filter String

addIncludeFilter

public void addIncludeFilter (String filter)

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

参数
filter String

addModuleName

public void addModuleName (String moduleName)

添加要运行的 Android 原生基准测试模块。

参数
moduleName String:要运行的原生测试模块的名称

cleanFilter

public String cleanFilter (String filter)

参数
filter String

返回
String

clearExcludeFilters

public void clearExcludeFilters ()

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

clearIncludeFilters

public void clearIncludeFilters ()

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

getDevice

public ITestDevice getDevice ()

获取被测设备。

返回
ITestDevice ITestDevice

getExcludeFilters

public Set<String> getExcludeFilters ()

返回当前的排除过滤条件Set

返回
Set<String>

getIncludeFilters

public Set<String> getIncludeFilters ()

返回当前的包含过滤条件Set

返回
Set<String>

getModuleNames

public List<String> getModuleNames ()

获取要运行的 Android 原生基准测试模块。

返回
List<String> 要运行的原生测试模块的名称,如果未设置,则为 null

run

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

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

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

listener ITestInvocationListener:测试结果的 ITestInvocationListener

抛出
DeviceNotAvailableException

setDevice

public void setDevice (ITestDevice device)

注入被测设备。

参数
device ITestDevice:要使用的 ITestDevice

setReportRunName

public void setReportRunName (String reportRunName)

参数
reportRunName String

受保护的方法

executeCommand

protected CommandResult executeCommand (ITestDevice testDevice, 
                String cmd)

用于运行基准测试命令的辅助方法。如果命令过长而无法直接通过 adb 运行,则会通过临时脚本运行。

参数
testDevice ITestDevice:要运行命令的设备

cmd String:要运行的命令字符串

返回
CommandResult 如果 outputReceiver 为 null,则为 shell 输出

抛出
DeviceNotAvailableException

getFilterFlagForFilters

protected String getFilterFlagForFilters (Set<String> filters)

参数
filters Set

返回
String

getFilterFlagForTests

protected String getFilterFlagForTests (Set<String> fitlererTests)

参数
fitlererTests Set

返回
String

shouldSkipFile

protected boolean shouldSkipFile (String fullPath)

用于确定是否应跳过指定文件的执行的辅助方法。

参数
fullPath String:相关文件的完整路径

返回
boolean 如果应跳过相应文件,则为 true。