diff options
author | Julien Desprez <jdesprez@google.com> | 2024-02-15 16:14:06 -0800 |
---|---|---|
committer | Julien Desprez <jdesprez@google.com> | 2024-02-15 16:14:06 -0800 |
commit | 3235178354d2318d39ba8f5aaa80c7e2800a0299 (patch) | |
tree | 6f517a2e21a2f3ef982eb39c53d0dc7ff41feca8 | |
parent | add98c614a18f1e62c3222b7cc37dee863def84c (diff) | |
download | tradefederation-3235178354d2318d39ba8f5aaa80c7e2800a0299.tar.gz |
Support already extracted test_mappings.zip in case of CAS download
Test: presubmit
Bug: 325520295
Change-Id: If0fac443d883c22fce5b45869b502c2d30a2fb3f
-rw-r--r-- | src/com/android/tradefed/util/testmapping/TestMapping.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/tradefed/util/testmapping/TestMapping.java b/src/com/android/tradefed/util/testmapping/TestMapping.java index 13c5bebe1..2199a8abd 100644 --- a/src/com/android/tradefed/util/testmapping/TestMapping.java +++ b/src/com/android/tradefed/util/testmapping/TestMapping.java @@ -493,7 +493,15 @@ public class TestMapping { } else { zipFile = buildInfo.getFile(TEST_MAPPINGS_ZIP); } - File testMappingsDir = extractTestMappingsZip(zipFile); + File testMappingsDir = null; + boolean delete = false; + // Handle already extracted entry + if (zipFile.isDirectory()) { + testMappingsDir = zipFile; + } else { + testMappingsDir = extractTestMappingsZip(zipFile); + delete = true; + } Path testMappingsRootPath = Paths.get(testMappingsDir.getAbsolutePath()); CLog.d("Relative test mapping paths: %s", mTestMappingRelativePaths); try (Stream<Path> stream = @@ -523,7 +531,9 @@ public class TestMapping { "IO exception (%s) when reading tests from TEST_MAPPING files (%s)", e.getMessage(), testMappingsDir.getAbsolutePath()), e); } finally { - FileUtil.recursiveDelete(testMappingsDir); + if (delete) { + FileUtil.recursiveDelete(testMappingsDir); + } } return tests; } |