TestMapping
public
class
TestMapping
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.testmapping.TestMapping |
A class for loading a TEST_MAPPING file.
Summary
Fields | |
---|---|
public
static
final
Pattern |
MAINLINE_REGEX
|
public
static
final
String |
TEST_SOURCES
|
Public constructors | |
---|---|
TestMapping(Path path, Path testMappingsDir,
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. |
static
|
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. |
static
|
getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly,
Helper to find all tests in all TEST_MAPPING files based on the given artifact. |
|
getTests(String testGroup,
Helper to get all tests set in a TEST_MAPPING file for a given group. |
static
|
getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly,
Helper to find all tests in all TEST_MAPPING files based on a artifact in the device build. |
static
void
|
listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir,
Helper to list all test mapping files, look for all parent directories and related import paths. |
static
void
|
setIgnoreTestMappingImports(boolean ignoreTestMappingImports)
Set the mIgnoreTestMappingImports inside TestMapping. |
static
void
|
setTestMappingPaths(
Set the TEST_MAPPING paths inside of TEST_MAPPINGS_ZIP to limit loading the TEST_MAPPING. |
Fields
MAINLINE_REGEX
public static final Pattern MAINLINE_REGEX
TEST_SOURCES
public static final String TEST_SOURCES
Public constructors
TestMapping
public TestMapping (Path path, Path testMappingsDir,matchedPatternPaths)
Constructor to create a TestMapping
object from a path to TEST_MAPPING file.
Parameters | |
---|---|
path |
Path : The ERROR(/Path) to a TEST_MAPPING file. |
testMappingsDir |
Path : The ERROR(/Path) to the folder of all TEST_MAPPING files for a build. |
matchedPatternPaths |
: The ERROR(/Set to file paths matched patterns. |
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
public staticgetAllTests (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
public staticgetTests (IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords, 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 ERROR(/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 ERROR(/String) to be matched when filtering tests to run in a Test
Mapping suite. |
extraZipNames |
: A set of ERROR(/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. |
getTests
publicgetTests (String testGroup, disabledTests, boolean hostOnly, keywords)
Helper to get all tests set in a TEST_MAPPING file for a given group.
Parameters | |
---|---|
testGroup |
String : A ERROR(/String) of the test group. |
disabledTests |
: A set of ERROR(/String) for the name of the disabled tests. |
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 ERROR(/String) to be matched when filtering tests to run in a Test
Mapping suite. |
Returns | |
---|---|
|
A Set<TestInfo> of the test infos. |
getTests
public staticgetTests (IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords)
Helper to find all tests in all TEST_MAPPING files based on a artifact in the device build.
Parameters | |
---|---|
buildInfo |
IBuildInfo : the IBuildInfo describing the build. |
testGroup |
String : a ERROR(/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 ERROR(/String) to be matched when filtering tests to run in a Test
Mapping suite. |
Returns | |
---|---|
|
A Set<TestInfo> of tests set in the build artifact, test_mappings.zip. |
listTestMappingFiles
public static 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. |
setIgnoreTestMappingImports
public static void setIgnoreTestMappingImports (boolean ignoreTestMappingImports)
Set the mIgnoreTestMappingImports inside TestMapping.
Parameters | |
---|---|
ignoreTestMappingImports |
boolean : A boolean of whether to ignore imports in test mapping. |
setTestMappingPaths
public static void setTestMappingPaths (relativePaths)
Set the TEST_MAPPING paths inside of TEST_MAPPINGS_ZIP to limit loading the TEST_MAPPING.
Parameters | |
---|---|
relativePaths |
: A List<String> of TEST_MAPPING paths relative to
TEST_MAPPINGS_ZIP. |