summaryrefslogtreecommitdiff
path: root/libartbase/base/file_utils_test.cc
diff options
context:
space:
mode:
author Alan Stokes <alanstokes@google.com> 2022-01-06 14:09:00 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-01-07 13:47:55 +0000
commita2e3936e53ff326d201623b539ebcd12cecc4bee (patch)
treec519f71b235b8d9385d428506d46a6b369a2fe36 /libartbase/base/file_utils_test.cc
parent0628e784532303b27e062ed957494bfd7e858bd9 (diff)
Ignore changes to irrelevant APEXes
When reading the list of APEXes, ignore any APEXes that do not contain any compilable JARs. Changes to such APEXes now do not and should not trigger recompilation. This is helpful for the CompOS use case, since it doesn't even see these APEXes. As part of this, extract existing code to determine APEX name from location and make it resuable. Bug: 210473615 Test: atest art_standalone_libartbase_tests Test: Presubmits Change-Id: I3f64e6228f091cabce33a292058f960787780f62
Diffstat (limited to 'libartbase/base/file_utils_test.cc')
-rw-r--r--libartbase/base/file_utils_test.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libartbase/base/file_utils_test.cc b/libartbase/base/file_utils_test.cc
index 913eedee03..dff4478549 100644
--- a/libartbase/base/file_utils_test.cc
+++ b/libartbase/base/file_utils_test.cc
@@ -330,4 +330,15 @@ TEST_F(FileUtilsTest, GetSystemOdexFilenameForApex) {
GetSystemOdexFilenameForApex(apex_jar.c_str(), InstructionSet::kArm));
}
+TEST_F(FileUtilsTest, ApexNameFromLocation) {
+ EXPECT_EQ("", ApexNameFromLocation(""));
+ EXPECT_EQ("", ApexNameFromLocation("/apex/com.android.foo"));
+ EXPECT_EQ("", ApexNameFromLocation("/apex//something"));
+ EXPECT_EQ("com.android.foo", ApexNameFromLocation("/apex/com.android.foo/"));
+ EXPECT_EQ("", ApexNameFromLocation("apex/com.android.foo/"));
+ EXPECT_EQ("foo", ApexNameFromLocation("/apex/foo/something.jar"));
+ EXPECT_EQ("", ApexNameFromLocation("/bar/foo/baz"));
+ EXPECT_EQ("", ApexNameFromLocation("/apexx/foo/baz"));
+}
+
} // namespace art