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 String TEST_SOURCES

Public constructors

TestMapping(Path path, Path testMappingsDir)

Constructor to create a TestMapping object from a path to TEST_MAPPING file.

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.

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

Helper to get all tests set in a TEST_MAPPING file for a given group.

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

Helper to find all tests in all TEST_MAPPING files.

Fields

TEST_SOURCES

public static final String TEST_SOURCES

Public constructors

TestMapping

public TestMapping (Path path, 
                Path testMappingsDir)

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.

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 static  getAllTests (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.

getTests

public  getTests (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 String of the test group.

disabledTests : A set of 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 String to be matched when filtering tests to run in a Test Mapping suite.

Returns
A Set<TestInfo> of the test infos.

getTests

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

Helper to find all tests in all TEST_MAPPING files. 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

Returns
A Set<TestInfo> of tests set in the build artifact, test_mappings.zip.