summaryrefslogtreecommitdiff
path: root/libnativeloader/library_namespaces_test.cpp
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2024-06-18 12:32:03 +0100
committer Martin Stjernholm <mast@google.com> 2024-06-19 16:21:05 +0000
commit7d4ebce2d8e15260ecdbfc6b3c67df3b5a7a09b4 (patch)
treec673c29bd85499256223001213cc42f609cf8c94 /libnativeloader/library_namespaces_test.cpp
parentb8d63dfa69260d79fa254c29ae432c16756fa73a (diff)
Recognise system/system_ext as a system image partition path.
Also move the regex used for that next to the other partition regex'es for visibility, and add some unit tests. Test: atest libnativeloader_tests libnativeloader_e2e_tests on mokey_go32 Bug: 346515837 Change-Id: I30a85678e0d3c45645d6f089f5f1d92e1360e8bf
Diffstat (limited to 'libnativeloader/library_namespaces_test.cpp')
-rw-r--r--libnativeloader/library_namespaces_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libnativeloader/library_namespaces_test.cpp b/libnativeloader/library_namespaces_test.cpp
index 706209a28e..0e2fa5de58 100644
--- a/libnativeloader/library_namespaces_test.cpp
+++ b/libnativeloader/library_namespaces_test.cpp
@@ -98,6 +98,23 @@ TEST(LibraryNamespacesTest, TestGetApiDomainFromPathList) {
}
}
+TEST(LibraryNamespacesTest, TestIsPartitionNativeLibPath) {
+ EXPECT_TRUE(IsPartitionNativeLibPath("/system/lib/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/system/lib64/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/system_ext/lib64/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/product/lib64/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/vendor/lib64/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/vendor/lib64/hw/libhw.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/system/system_ext/lib64/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/system/product/lib64/libfoo.so"));
+ EXPECT_TRUE(IsPartitionNativeLibPath("/system/vendor/lib64/libfoo.so"));
+
+ EXPECT_FALSE(IsPartitionNativeLibPath("/data/app/~~hash==/myapp-hash==/lib/arm64/libapp.so"));
+ EXPECT_FALSE(
+ IsPartitionNativeLibPath("/system/app/PrintSpooler/lib/arm64/libprintspooler_jni.so"));
+ EXPECT_FALSE(IsPartitionNativeLibPath("/product/app/Camera2/lib/arm64/libjni_jpegutil.so"));
+}
+
} // namespace
} // namespace nativeloader
} // namespace android