TestMapping

public class TestMapping
extends Object

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


用于加载 TEST_MAPPING 文件的类。

摘要

字段

public static final Pattern MAINLINE_REGEX

public static final String TEST_SOURCES

公共构造函数

TestMapping(Path path, Path testMappingsDir)

用于从 TEST_MAPPING 文件的路径创建 TestMapping 对象的构造函数。

公共方法

static File extractTestMappingsZip(File testMappingsZip)

解压缩 zip 文件并返回解压缩文件内容所在的目录。

static getAllTests(File testMappingsDir)

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

static Matcher getMainlineTestModuleName(TestInfo info)

帮助获取参数化 Mainline 测试的匹配器。

getTests(String testGroup, disabledTests, boolean hostOnly, keywords)

帮助程序获取 TEST_MAPPING 文件中为指定组设置的所有测试。

static getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords)

用于查找所有 TEST_MAPPING 文件中的所有测试的辅助程序。

static void listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, filePaths)

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

static void setIgnoreTestMappingImports(boolean ignoreTestMappingImports)

在 TestMapping 内设置 mIgnoreTestMappingImports。

static void setTestMappingPaths( relativePaths)

设置 TEST_MAPPINGS_ZIP 内的 TEST_MAPPING 路径以限制加载 TEST_MAPPING。

字段

MAINLINE_REGEX

public static final Pattern MAINLINE_REGEX

测试来源

public static final String TEST_SOURCES

公共构造函数

TestMapping

public TestMapping (Path path, 
                Path testMappingsDir)

用于从 TEST_MAPPING 文件的路径创建 TestMapping 对象的构造函数。

参数
path Path:TEST_MAPPING 文件的 ERROR(/Path)

testMappingsDir PathERROR(/Path) 到 build 的所有 TEST_MAPPING 文件所在的文件夹。

公共方法

extractTestMappingsZip 文件

public static File extractTestMappingsZip (File testMappingsZip)

解压缩 zip 文件并返回解压缩文件内容所在的目录。

参数
testMappingsZip File:要提取的测试映射 zip 的 ERROR(/File)

返回
File 指向用于测试映射 ZIP 的临时目录的 ERROR(/File)

getAllTest

public static  getAllTests (File testMappingsDir)

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

参数
testMappingsDir FileERROR(/File) 是包含所有 Test Mapping 文件的目录。

返回
由指定目录及其子项中的测试组成的 Map<String, Set<TestInfo>> 目录。

getMainlineTestModuleName

public static Matcher getMainlineTestModuleName (TestInfo info)

帮助获取参数化 Mainline 测试的匹配器。

参数
info TestInfo

返回
Matcher 用于参数化 Mainline 测试的 ERROR(/Matcher)

抛出
ConfigurationException

getTest

public  getTests (String testGroup, 
                 disabledTests, 
                boolean hostOnly, 
                 keywords)

帮助程序获取 TEST_MAPPING 文件中为指定组设置的所有测试。

参数
testGroup String:测试组的 String

disabledTests :一组 String,用于表示已停用测试的名称。

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

keywords :过滤要在测试中运行的测试时要匹配的一组 String 地图套件。

返回
测试信息的 Set<TestInfo>

getTest

public static  getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                 keywords)

用于查找所有 TEST_MAPPING 文件中的所有测试的辅助程序。当套件运行需要 针对指定组运行 TEST_MAPPING 文件中的所有测试,例如提交前测试。

参数
buildInfo IBuildInfo:描述构建的 IBuildInfo

testGroup String:测试组的 String

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

keywords

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

listTestMappingFiles

public static void listTestMappingFiles (Path testMappingDir, 
                Path testMappingsRootDir, 
                 filePaths)

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

参数
testMappingDir Path:TEST_MAPPING 文件父目录的 ERROR(/Path)

testMappingsRootDir Path:将 ERROR(/Path) 复制到包含某个测试文件的所有 TEST_MAPPING 文件的文件夹 build。

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

setIgnoreTestMappingImports

public static void setIgnoreTestMappingImports (boolean ignoreTestMappingImports)

在 TestMapping 内设置 mIgnoreTestMappingImports。

参数
ignoreTestMappingImports boolean:布尔值,表示是否在测试映射中忽略导入。

setTestMappingPaths

public static void setTestMappingPaths ( relativePaths)

设置 TEST_MAPPINGS_ZIP 内的 TEST_MAPPING 路径以限制加载 TEST_MAPPING。

参数
relativePaths :TEST_MAPPING 路径的 List<String> TEST_MAPPINGS_ZIP。