diff options
author | 2024-01-30 21:33:09 +0000 | |
---|---|---|
committer | 2024-02-15 18:22:04 +0000 | |
commit | 8a9b51e34f3769a5e3ea3a4383e3f00489088738 (patch) | |
tree | 37b3705e0387d216b50bc2d1e027b1f8ccf5f914 /libnativeloader/native_loader_test.cpp | |
parent | 149b912110c31a2e1e69930e48fed8bbfbe04700 (diff) |
Refactorings to make more logic available at the top level in
native_loader.cpp.
- Make the code that determines the partition from the dex path
available to code in native_loader.cpp, and rename it since it'll be
applied to arbitrary paths, not just APK's.
- Move the linker namespace constants to a header file.
- Various other minor code cleanups.
To prepare for a later CL that needs to access these things from
OpenNativeLibrary. No functional changes.
Test: atest libnativeloader_e2e_tests libnativeloader_test
Bug: 237577392
Change-Id: Ifc762bf6d4664b2d477c4ed3af58f149fb4c1189
Diffstat (limited to 'libnativeloader/native_loader_test.cpp')
-rw-r--r-- | libnativeloader/native_loader_test.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp index 72348ed364..3b05aae06b 100644 --- a/libnativeloader/native_loader_test.cpp +++ b/libnativeloader/native_loader_test.cpp @@ -564,7 +564,8 @@ jni com_android_bar libbar.so:libbar2.so public com_android_bar libpublic.so )"; - auto jni_libs = ParseApexLibrariesConfig(file_content, "jni"); + Result<std::map<std::string, std::string>> jni_libs = + ParseApexLibrariesConfig(file_content, "jni"); ASSERT_RESULT_OK(jni_libs); std::map<std::string, std::string> expected_jni_libs { {"com_android_foo", "libfoo.so"}, @@ -572,7 +573,8 @@ jni com_android_bar libbar.so:libbar2.so }; ASSERT_EQ(expected_jni_libs, *jni_libs); - auto public_libs = ParseApexLibrariesConfig(file_content, "public"); + Result<std::map<std::string, std::string>> public_libs = + ParseApexLibrariesConfig(file_content, "public"); ASSERT_RESULT_OK(public_libs); std::map<std::string, std::string> expected_public_libs { {"com_android_bar", "libpublic.so"}, @@ -586,7 +588,7 @@ jni com_android_foo libfoo # missing <library list> jni com_android_bar )"; - auto result = ParseApexLibrariesConfig(file_content, "jni"); + Result<std::map<std::string, std::string>> result = ParseApexLibrariesConfig(file_content, "jni"); ASSERT_FALSE(result.ok()); ASSERT_EQ("Malformed line \"jni com_android_bar\"", result.error().message()); } @@ -598,7 +600,7 @@ public apex2 lib # unknown tag unknown com_android_foo libfoo )"; - auto result = ParseApexLibrariesConfig(file_content, "jni"); + Result<std::map<std::string, std::string>> result = ParseApexLibrariesConfig(file_content, "jni"); ASSERT_FALSE(result.ok()); ASSERT_EQ("Invalid tag \"unknown com_android_foo libfoo\"", result.error().message()); } @@ -608,7 +610,7 @@ TEST(NativeLoaderApexLibrariesConfigParser, RejectInvalidApexNamespace) { # apex linker namespace should be mangled ('.' -> '_') jni com.android.foo lib )"; - auto result = ParseApexLibrariesConfig(file_content, "jni"); + Result<std::map<std::string, std::string>> result = ParseApexLibrariesConfig(file_content, "jni"); ASSERT_FALSE(result.ok()); ASSERT_EQ("Invalid apex_namespace \"jni com.android.foo lib\"", result.error().message()); } @@ -618,7 +620,7 @@ TEST(NativeLoaderApexLibrariesConfigParser, RejectInvalidLibraryList) { # library list is ":" separated list of filenames jni com_android_foo lib64/libfoo.so )"; - auto result = ParseApexLibrariesConfig(file_content, "jni"); + Result<std::map<std::string, std::string>> result = ParseApexLibrariesConfig(file_content, "jni"); ASSERT_FALSE(result.ok()); ASSERT_EQ("Invalid library_list \"jni com_android_foo lib64/libfoo.so\"", result.error().message()); } |