Update docstring in Test Mapping
- Fix some typos
- Update docstring for missing params.
Bug: 279522874
Test: run_tradefed_tests.sh --class com.android.tradefed.util.testmapping.TestMappingTest
Test: run_tradefed_tests.sh --class com.android.tradefed.testtype.suite.TestMappingSuiteRunnerTest
Change-Id: I3c9af8f14af36e3444c99ee89a185d64b5723f5c
diff --git a/javatests/com/android/tradefed/testtype/suite/TestMappingSuiteRunnerTest.java b/javatests/com/android/tradefed/testtype/suite/TestMappingSuiteRunnerTest.java
index 956bb79..034a7b6 100644
--- a/javatests/com/android/tradefed/testtype/suite/TestMappingSuiteRunnerTest.java
+++ b/javatests/com/android/tradefed/testtype/suite/TestMappingSuiteRunnerTest.java
@@ -828,8 +828,8 @@
}
/**
- * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, String)} that IRemoteTest
- * object are created according to the test infos with different test options.
+ * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, IConfiguration, IAbi)} that
+ * IRemoteTest object are created according to the test infos with different test options.
*/
@Test
public void testCreateIndividualTestsWithDifferentTestInfos() throws Exception {
@@ -847,7 +847,7 @@
}
/**
- * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, String, IAbi)} that
+ * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, IConfiguration, IAbi)} that
* IRemoteTest object are created according to the test infos with multiple test options.
*/
@Test
@@ -868,7 +868,7 @@
}
/**
- * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, String, IAbi)} that
+ * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, IConfiguration, IAbi)} that
* IRemoteTest object are created according to the test infos with multiple test options and top
* level exclude-filter tests.
*/
@@ -933,7 +933,7 @@
for (Entry<String, IConfiguration> config : configMap.entrySet()) {
IConfiguration currentConfig = config.getValue();
IAbi abi = currentConfig.getConfigurationDescription().getAbi();
- // Ensure that all the sub-tests abi match the module abi
+ // Ensure that all the subtests abi match the module abi
for (IRemoteTest test : currentConfig.getTests()) {
if (test instanceof IAbiReceiver) {
assertEquals(abi, ((IAbiReceiver) test).getAbi());
@@ -999,7 +999,7 @@
}
/**
- * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, String, IAbi)} that
+ * Test for {@link TestMappingSuiteRunner#createIndividualTests(Set, IConfiguration, IAbi)} that
* IRemoteTest object are created according to the test infos with the same test options and
* name.
*/
@@ -1076,8 +1076,8 @@
}
/**
- * Test for {@link TestMappingSuiteRunner#filterByAllowedTestLists()} for filtering tests from a
- * list of allowed test lists.
+ * Test for {@link TestMappingSuiteRunner#filterByAllowedTestLists(Set)} for filtering tests
+ * from a list of allowed test lists.
*/
@Test
public void testFilterByAllowedTestLists() throws Exception {
@@ -1142,7 +1142,7 @@
}
/**
- * Test for {@link TestMappingSuiteRunner#loadTests()} ()} for loading tests when full run is
+ * Test for {@link TestMappingSuiteRunner#loadTests()} for loading tests when full run is
* forced.
*/
@Test
diff --git a/javatests/com/android/tradefed/util/testmapping/TestMappingTest.java b/javatests/com/android/tradefed/util/testmapping/TestMappingTest.java
index 3715aee..bc9ee88 100644
--- a/javatests/com/android/tradefed/util/testmapping/TestMappingTest.java
+++ b/javatests/com/android/tradefed/util/testmapping/TestMappingTest.java
@@ -160,7 +160,7 @@
}
}
- /** Test for {@link TestMapping#getTests()} throw exception for malformated json file. */
+ /** Test for {@link TestMapping#getTests()} throw exception for malformatted json file. */
@Test(expected = RuntimeException.class)
public void testparseTestMapping_BadJson() throws Exception {
File tempDir = null;
@@ -607,7 +607,7 @@
}
}
- /** Test for {@link TestMapping#extractTestMappingsZip()} for extracting test mappings zip. */
+ /** Test for {@link TestMapping#getDisabledTests()} for getting disabled tests. */
@Test
public void testGetDisabledTests() throws Exception {
File tempDir = null;
diff --git a/src/com/android/tradefed/testtype/suite/TestMappingSuiteRunner.java b/src/com/android/tradefed/testtype/suite/TestMappingSuiteRunner.java
index 3cc8503..17f30ea 100644
--- a/src/com/android/tradefed/testtype/suite/TestMappingSuiteRunner.java
+++ b/src/com/android/tradefed/testtype/suite/TestMappingSuiteRunner.java
@@ -327,6 +327,7 @@
*
* @param testInfos A {@code Set<TestInfo>} containing multiple test options.
* @param moduleConfig The {@link IConfiguration} of the module config.
+ * @param abi The {@link IAbi} of abi information.
* @return The {@link List} that are injected with the test options.
*/
@VisibleForTesting
@@ -379,9 +380,15 @@
return tests;
}
- /** Add test mapping's path into module configuration. */
- private void addTestSourcesToConfig(IConfiguration config, List<IRemoteTest> tests,
- Set<String> sources) {
+ /**
+ * Add test mapping's path into module configuration.
+ *
+ * @param config The {@link IConfiguration} of the module config.
+ * @param tests The {@link List<IRemoteTest>} of the tests.
+ * @param sources The {@link Set<String>} of test mapping sources.
+ */
+ private void addTestSourcesToConfig(
+ IConfiguration config, List<IRemoteTest> tests, Set<String> sources) {
for (IRemoteTest test : tests) {
config.getConfigurationDescription().addMetadata(
Integer.toString(test.hashCode()), new ArrayList<>(sources)
diff --git a/src/com/android/tradefed/util/testmapping/TestMapping.java b/src/com/android/tradefed/util/testmapping/TestMapping.java
index f99c929..0a60ad1 100644
--- a/src/com/android/tradefed/util/testmapping/TestMapping.java
+++ b/src/com/android/tradefed/util/testmapping/TestMapping.java
@@ -59,7 +59,7 @@
/** A class for loading a TEST_MAPPING file. */
public class TestMapping {
- // Key for test sources information stored in meta data of ConfigurationDescription.
+ // Key for test sources information stored in metadata of ConfigurationDescription.
public static final String TEST_SOURCES = "Test Sources";
// Pattern used to identify mainline tests without parameterized modules configured.
public static final Pattern MAINLINE_REGEX = Pattern.compile("(\\S+)\\[(\\S+)\\]");
@@ -102,13 +102,12 @@
}
/**
- * Helper to get the {@link Map<String, Set<TestInfo>>} test collection from a path to
- * TEST_MAPPING file.
+ * Helper to get the {@link Map} test collection from a path to TEST_MAPPING file.
*
* @param path The {@link Path} to a TEST_MAPPING file.
* @param testMappingsDir The {@link Path} to the folder of all TEST_MAPPING files for a build.
* @param matchedPatternPaths The {@link Set<String>} to file paths matched patterns.
- * @return A {@link Map<String, Set<TestInfo>>} of test collection.
+ * @return A {@link Map} of test collection.
*/
@VisibleForTesting
Map<String, Set<TestInfo>> getTestCollection(
@@ -227,7 +226,7 @@
/**
* Helper to check whether the given matched-pattern-paths matches the file patterns.
*
- * @param testMappingDir A {@link String} to Test_MAPPING directory path.
+ * @param testMappingDir A {@link String} to TEST_MAPPING directory path.
* @param matchedPatternPaths A {@link Set<String>} to file paths matched patterns.
* @param filePatterns A {@link Set<String>} to filePatterns from a TEST_MAPPING file.
* @return A {@link Boolean} of matched result.
@@ -424,7 +423,7 @@
}
/**
- * Helper to find all tests in all TEST_MAPPING files based on a artifact in the device build.
+ * Helper to find all tests in all TEST_MAPPING files based on an artifact in the device build.
*
* @param buildInfo the {@link IBuildInfo} describing the build.
* @param testGroup a {@link String} of the test group.
@@ -692,11 +691,16 @@
/**
* Merge additional test mapping zips into the given directory.
+ *
+ * @param buildInfo the {@link IBuildInfo} describing the build.
+ * @param extraZips A {@link List<String>} of additional zip file paths.
+ * @param baseFile A {@link File} of base test mapping zip.
+ * @param baseDir A {@link File} pointing to the temp directory for base test mappings zip.
*/
@VisibleForTesting
static void mergeTestMappingZips(
- IBuildInfo buildInfo, List<String> extraZips, File baseFile, File baseDir)
- throws IOException {
+ IBuildInfo buildInfo, List<String> extraZips, File baseFile, File baseDir)
+ throws IOException {
Set<String> baseNames = getTestMappingSources(baseFile);
for (String zipName : extraZips) {
File zipFile;
@@ -719,6 +723,10 @@
/**
* Helper to validate whether there exists collision of the path of Test Mapping files.
+ *
+ * @param base A {@link Set<String>} of the file paths.
+ * @param target A {@link Set<String>} of the file paths.
+ * @param zipName A {@link String} of the zip file path.
*/
private static void validateSources(Set<String> base, Set<String> target, String zipName) {
for (String name : target) {
@@ -732,6 +740,9 @@
/**
* Helper to collect the path of Test Mapping files with a given zip file.
+ *
+ * @param zipFile A {@link File} of the test mappings zip.
+ * @return A {@link Set<String>} for file paths from the test mappings zip.
*/
@VisibleForTesting
static Set<String> getTestMappingSources(File zipFile) {