TestMapping

public class TestMapping
extends Object

java.lang.Object
com.android.tradefed.util.testmapping.TestMapping


用于加载 TEST_MAPPING 文件的类。

摘要

嵌套的类

class TestMapping.NoTestRuntimeException

 

常量

String TEST_MAPPINGS_ZIP

String TEST_SOURCES

字段

public static final Pattern MAINLINE_REGEX

公共构造函数

TestMapping()

用于初始化空 TestMapping 对象的构造函数。

TestMapping(List<String> testMappingRelativePaths, boolean ignoreTestMappingImports)

用于创建 TestMapping 对象的构造函数。

公共方法

static File extractTestMappingsZip(File testMappingsZip)

提取 zip 文件并返回包含解压缩文件内容的目录。

Map<String, Set<TestInfo>> getAllTests(File testMappingsDir)

用于查找给定目录中 TEST_MAPPING 文件中的所有测试的帮助程序。

static Matcher getMainlineTestModuleName(TestInfo info)

用于获取参数化 Mainline 测试的匹配器的帮助程序。

Set<TestInfo> getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch, List<String> extraZipNames, Set<String> matchedPatternPaths)

用于根据给定的工件查找所有 TEST_MAPPING 文件中的所有测试的帮助程序。

Set<TestInfo> getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch)

用于根据设备 build 中的工件查找所有 TEST_MAPPING 文件中的所有测试的帮助程序。

void listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, Set<Path> filePaths)

用于列出所有测试映射文件、查找所有父目录和相关导入 路径。

常量

TEST_MAPPINGS_ZIP

public static final String TEST_MAPPINGS_ZIP

常量值: "test_mappings.zip"

TEST_SOURCES

public static final String TEST_SOURCES

常量值: "Test Sources"

字段

MAINLINE_REGEX

public static final Pattern MAINLINE_REGEX

公共构造函数

TestMapping

public TestMapping ()

用于初始化空 TestMapping 对象的构造函数。

TestMapping

public TestMapping (List<String> testMappingRelativePaths, 
                boolean ignoreTestMappingImports)

用于创建 TestMapping 对象的构造函数。

参数
testMappingRelativePaths List:指向 TEST_MAPPING 文件路径的 ERROR(/List)

ignoreTestMappingImports boolean:用于忽略导入的 ERROR(/boolean)

公共方法

extractTestMappingsZip

public static File extractTestMappingsZip (File testMappingsZip)

提取 zip 文件并返回包含解压缩文件内容的目录。

参数
testMappingsZip File:要提取的测试映射 zip 的 File

返回
File 指向测试映射 zip 的临时目录的 File

getAllTests

public Map<String, Set<TestInfo>> getAllTests (File testMappingsDir)

用于查找给定目录中 TEST_MAPPING 文件中的所有测试的帮助程序。

参数
testMappingsDir File:包含所有测试映射文件的目录的 File

返回
Map<String, Set<TestInfo>> 给定目录及其子目录中的测试的 Map<String, Set<TestInfo>>

getMainlineTestModuleName

public static Matcher getMainlineTestModuleName (TestInfo info)

用于获取参数化 Mainline 测试的匹配器的帮助程序。

参数
info TestInfo

返回
Matcher 参数化 Mainline 测试的 Matcher

抛出
ConfigurationException

getTests

public Set<TestInfo> getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                Set<String> keywords, 
                Set<String> ignoreKeywords, 
                boolean exactKeywordMatch, 
                List<String> extraZipNames, 
                Set<String> matchedPatternPaths)

用于根据给定的工件查找所有 TEST_MAPPING 文件中的所有测试的帮助程序。当套件运行需要为给定组 (例如 presubmit) 运行 TEST_MAPPING 文件中的所有测试时,需要此帮助程序。

参数
buildInfo IBuildInfo:描述 build 的 IBuildInfo

testGroup String:测试组的 String

hostOnly boolean:如果仅应返回在主机上运行且不需要设备的测试,则为 true。如果返回需要设备运行的测试,则为 false。

keywords Set:一组 String,用于在过滤要在测试映射套件中运行的测试时进行匹配。

ignoreKeywords Set:一组要忽略的关键字的 String

exactKeywordMatch boolean

extraZipNames List:一组 String,用于将合并的其他 test_mappings.zip 的名称。

matchedPatternPaths Set:与模式匹配的文件路径的 ERROR(/Set)

返回
Set<TestInfo> 在 build 工件 test_mappings.zip 中设置的测试的 Set<TestInfo>

getTests

public Set<TestInfo> getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                Set<String> keywords, 
                Set<String> ignoreKeywords, 
                boolean exactKeywordMatch)

用于根据设备 build 中的工件查找所有 TEST_MAPPING 文件中的所有测试的帮助程序。

参数
buildInfo IBuildInfo:描述 build 的 IBuildInfo

testGroup String:测试组的 String

hostOnly boolean:如果仅应返回在主机上运行且不需要设备的测试,则为 true。如果返回需要设备运行的测试,则为 false。

keywords Set:一组 String,用于在过滤要在测试映射套件中运行的测试时进行匹配。

ignoreKeywords Set:一组要忽略的关键字的 String

exactKeywordMatch boolean

返回
Set<TestInfo> 在 build 工件 test_mappings.zip 中设置的测试的 Set<TestInfo>

listTestMappingFiles

public void listTestMappingFiles (Path testMappingDir, 
                Path testMappingsRootDir, 
                Set<Path> filePaths)

用于列出所有测试映射文件、查找所有父目录和相关导入 路径的帮助程序。

参数
testMappingDir Path:指向 TEST_MAPPING 文件父目录的 Path

testMappingsRootDir Path:指向 build 的所有 TEST_MAPPING 文件的文件夹的 Path

filePaths Set:用于存储所有 TEST_MAPPING 路径的 ERROR(/Set)