TestMapping
public
class
TestMapping
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.util.testmapping.TestMapping |
A class for loading a TEST_MAPPING file.
Summary
Nested classes | |
|---|---|
class |
TestMapping.NoTestRuntimeException
|
Constants | |
|---|---|
String |
TEST_MAPPINGS_ZIP
|
String |
TEST_SOURCES
|
Fields | |
|---|---|
public
static
final
Pattern |
MAINLINE_REGEX
|
Public constructors | |
|---|---|
TestMapping()
Constructor to initialize an empty |
|
TestMapping(List<String> testMappingRelativePaths, boolean ignoreTestMappingImports)
Constructor to create a |
|
Public methods | |
|---|---|
static
File
|
extractTestMappingsZip(File testMappingsZip)
Extract a zip file and return the directory that contains the content of unzipped files. |
Map<String, Set<TestInfo>>
|
getAllTests(File testMappingsDir)
Helper to find all tests in the TEST_MAPPING files from a given directory. |
static
Matcher
|
getMainlineTestModuleName(TestInfo info)
Helper to get the matcher for parameterized mainline tests. |
Set<TestInfo>
|
getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch, List<String> extraZipNames, Set<String> matchedPatternPaths)
Helper to find all tests in all TEST_MAPPING files based on the given artifact. |
Set<TestInfo>
|
getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch)
Helper to find all tests in all TEST_MAPPING files based on an artifact in the device build. |
void
|
listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, Set<Path> filePaths)
Helper to list all test mapping files, look for all parent directories and related import paths. |
Constants
TEST_MAPPINGS_ZIP
public static final String TEST_MAPPINGS_ZIP
Constant Value: "test_mappings.zip"
TEST_SOURCES
public static final String TEST_SOURCES
Constant Value: "Test Sources"
Fields
MAINLINE_REGEX
public static final Pattern MAINLINE_REGEX
Public constructors
TestMapping
public TestMapping (List<String> testMappingRelativePaths,
boolean ignoreTestMappingImports)Constructor to create a TestMapping object.
| Parameters | |
|---|---|
testMappingRelativePaths |
List: The ERROR(/List to the TEST_MAPPING file paths. |
ignoreTestMappingImports |
boolean: The ERROR(/boolean) to ignore imports. |
Public methods
extractTestMappingsZip
public static File extractTestMappingsZip (File testMappingsZip)
Extract a zip file and return the directory that contains the content of unzipped files.
| Parameters | |
|---|---|
testMappingsZip |
File: A File of the test mappings zip to extract. |
| Returns | |
|---|---|
File |
a File pointing to the temp directory for test mappings zip. |
getAllTests
public Map<String, Set<TestInfo>> getAllTests (File testMappingsDir)
Helper to find all tests in the TEST_MAPPING files from a given directory.
| Parameters | |
|---|---|
testMappingsDir |
File: the File the directory containing all Test Mapping files. |
| Returns | |
|---|---|
Map<String, Set<TestInfo>> |
A Map<String, Set<TestInfo>> of tests in the given directory and its child
directories. |
getMainlineTestModuleName
public static Matcher getMainlineTestModuleName (TestInfo info)
Helper to get the matcher for parameterized mainline tests.
| Parameters | |
|---|---|
info |
TestInfo |
| Returns | |
|---|---|
Matcher |
A Matcher for parameterized mainline tests. |
| Throws | |
|---|---|
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)
Helper to find all tests in all TEST_MAPPING files based on the given artifact. This is needed when a suite run requires to run all tests in TEST_MAPPING files for a given group, e.g., presubmit.
| Parameters | |
|---|---|
buildInfo |
IBuildInfo: the IBuildInfo describing the build. |
testGroup |
String: a String of the test group. |
hostOnly |
boolean: true if only tests running on host and don't require device should be
returned. false to return tests that require device to run. |
keywords |
Set: A set of String to be matched when filtering tests to run in a Test
Mapping suite. |
ignoreKeywords |
Set: A set of String of keywords to be ignored. |
exactKeywordMatch |
boolean |
extraZipNames |
List: A set of String for the name of additional test_mappings.zip
that will be merged. |
matchedPatternPaths |
Set: The ERROR(/Set to file paths matched patterns. |
| Returns | |
|---|---|
Set<TestInfo> |
A Set<TestInfo> of tests set in the build artifact, test_mappings.zip. |
getTests
public Set<TestInfo> getTests (IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch)
Helper to find all tests in all TEST_MAPPING files based on an artifact in the device build.
| Parameters | |
|---|---|
buildInfo |
IBuildInfo: the IBuildInfo describing the build. |
testGroup |
String: a String of the test group. |
hostOnly |
boolean: true if only tests running on host and don't require device should be
returned. false to return tests that require device to run. |
keywords |
Set: A set of String to be matched when filtering tests to run in a Test
Mapping suite. |
ignoreKeywords |
Set: A set of String of keywords to be ignored. |
exactKeywordMatch |
boolean |
| Returns | |
|---|---|
Set<TestInfo> |
A Set<TestInfo> of tests set in the build artifact, test_mappings.zip. |
listTestMappingFiles
public void listTestMappingFiles (Path testMappingDir,
Path testMappingsRootDir,
Set<Path> filePaths)Helper to list all test mapping files, look for all parent directories and related import paths.
| Parameters | |
|---|---|
testMappingDir |
Path: The Path to a TEST_MAPPING file parent directory. |
testMappingsRootDir |
Path: The Path to the folder of all TEST_MAPPING files for a
build. |
filePaths |
Set: A ERROR(/Set to store all TEST_MAPPING paths. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-06-22 UTC.