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
|
Fields | |
|---|---|
public
static
final
Pattern |
MAINLINE_REGEX
|
public
static
final
String |
TEST_MAPPINGS_ZIP
|
public
static
final
String |
TEST_SOURCES
|
Public constructors | |
|---|---|
TestMapping()
Constructor to initialize an empty |
|
TestMapping(
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. |
|
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. |
|
getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly,
Helper to find all tests in all TEST_MAPPING files based on an artifact in the device build. |
|
getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly,
Helper to find all tests in all TEST_MAPPING files based on the given artifact. |
void
|
listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir,
Helper to list all test mapping files, look for all parent directories and related import paths. |
Fields
MAINLINE_REGEX
public static final Pattern MAINLINE_REGEX
TEST_MAPPINGS_ZIP
public static final String TEST_MAPPINGS_ZIP
TEST_SOURCES
public static final String TEST_SOURCES
Public constructors
TestMapping
public TestMapping (testMappingRelativePaths, boolean ignoreTestMappingImports)
Constructor to create a TestMapping object.
| Parameters | |
|---|---|
testMappingRelativePaths |
: 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 ERROR(/File) of the test mappings zip to extract. |
| Returns | |
|---|---|
File |
a ERROR(/File) pointing to the temp directory for test mappings zip. |
getAllTests
publicgetAllTests (File testMappingsDir)
Helper to find all tests in the TEST_MAPPING files from a given directory.
| Parameters | |
|---|---|
testMappingsDir |
File: the ERROR(/File) the directory containing all Test Mapping files. |
| Returns | |
|---|---|
|
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 ERROR(/Matcher) for parameterized mainline tests. |
| Throws | |
|---|---|
ConfigurationException |
|
getTests
publicgetTests (IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords, ignoreKeywords)
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 |
: A set of String to be matched when filtering tests to run in a Test
Mapping suite. |
ignoreKeywords |
: A set of String of keywords to be ignored. |
| Returns | |
|---|---|
|
A Set<TestInfo> of tests set in the build artifact, test_mappings.zip. |
getTests
publicgetTests (IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords, ignoreKeywords, extraZipNames, 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 |
: A set of String to be matched when filtering tests to run in a Test
Mapping suite. |
ignoreKeywords |
: A set of String of keywords to be ignored. |
extraZipNames |
: A set of String for the name of additional test_mappings.zip
that will be merged. |
matchedPatternPaths |
: The ERROR(/Set to file paths matched patterns. |
| Returns | |
|---|---|
|
A Set<TestInfo> of tests set in the build artifact, test_mappings.zip. |
listTestMappingFiles
public void listTestMappingFiles (Path testMappingDir,
Path testMappingsRootDir,
filePaths) Helper to list all test mapping files, look for all parent directories and related import paths.
| Parameters | |
|---|---|
testMappingDir |
Path: The ERROR(/Path) to a TEST_MAPPING file parent directory. |
testMappingsRootDir |
Path: The ERROR(/Path) to the folder of all TEST_MAPPING files for a
build. |
filePaths |
: 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 2025-06-12 UTC.