summaryrefslogtreecommitdiff
path: root/libnativeloader/native_loader_test.cpp
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2022-03-24 00:50:33 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-03-24 06:54:13 +0000
commit630cb4e882a7fec160bc9f8a3b5688be0fddd3fc (patch)
treec75f158ef2b04c8cb68f9dc559f6cfcdd73d6ad5 /libnativeloader/native_loader_test.cpp
parent9292b88f07dff23b6dcafff07bfdeb2e67809149 (diff)
Fix expected system links when there are extended public libraries on
the device. This fix accounts for this code path: https://cs.android.com/android/platform/superproject/+/master:art/libnativeloader/library_namespaces.cpp;l=278;drc=cab0d313ba4c938e2f19cd9d1daf361dc5a99dca It only fails on devices that specify libraries in public.libraries-<companyname>.txt files. Test: On an ordinary device that doesn't already have such a file: adb root && adb remount && adb reboot && \ adb wait-for-device && adb remount adb shell \ "echo libx.google.so > system_ext/etc/public.libraries-google.txt" atest libnativeloader_test adb shell rm system_ext/etc/public.libraries-google.txt atest libnativeloader_test Bug: 225768865 Change-Id: Ifb0a9cc5f044107a4baf2136a11feff6c34cd596
Diffstat (limited to 'libnativeloader/native_loader_test.cpp')
-rw-r--r--libnativeloader/native_loader_test.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 878b9f8f1f..9648713e70 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -167,6 +167,15 @@ INSTANTIATE_TEST_SUITE_P(NativeLoaderTests, NativeLoaderTest, testing::Bool());
/////////////////////////////////////////////////////////////////
+std::string default_public_and_extended_libraries() {
+ std::string public_libs = default_public_libraries();
+ std::string ext_libs = extended_public_libraries();
+ if (!ext_libs.empty()) {
+ public_libs = public_libs + ":" + ext_libs;
+ }
+ return public_libs;
+}
+
class NativeLoaderTest_Create : public NativeLoaderTest {
protected:
// Test inputs (initialized to the default values). Overriding these
@@ -195,7 +204,7 @@ class NativeLoaderTest_Create : public NativeLoaderTest {
bool expected_link_with_vndk_product_ns = false;
bool expected_link_with_default_ns = false;
bool expected_link_with_neuralnetworks_ns = true;
- std::string expected_shared_libs_to_platform_ns = default_public_libraries();
+ std::string expected_shared_libs_to_platform_ns = default_public_and_extended_libraries();
std::string expected_shared_libs_to_art_ns = apex_public_libraries().at("com_android_art");
std::string expected_shared_libs_to_i18n_ns = apex_public_libraries().at("com_android_i18n");
std::string expected_shared_libs_to_conscrypt_ns = apex_jni_libraries("com_android_conscrypt");
@@ -203,7 +212,7 @@ class NativeLoaderTest_Create : public NativeLoaderTest {
std::string expected_shared_libs_to_product_ns = product_public_libraries();
std::string expected_shared_libs_to_vndk_ns = vndksp_libraries_vendor();
std::string expected_shared_libs_to_vndk_product_ns = vndksp_libraries_product();
- std::string expected_shared_libs_to_default_ns = default_public_libraries();
+ std::string expected_shared_libs_to_default_ns = default_public_and_extended_libraries();
std::string expected_shared_libs_to_neuralnetworks_ns = apex_public_libraries().at("com_android_neuralnetworks");
void SetExpectations() {
@@ -334,7 +343,7 @@ TEST_P(NativeLoaderTest_Create, UnbundledVendorApp) {
expected_library_path = expected_library_path + ":/vendor/" LIB_DIR;
expected_permitted_path = expected_permitted_path + ":/vendor/" LIB_DIR;
expected_shared_libs_to_platform_ns =
- expected_shared_libs_to_platform_ns + ":" + llndk_libraries_vendor();
+ default_public_libraries() + ":" + llndk_libraries_vendor();
expected_link_with_vndk_ns = true;
SetExpectations();
RunTest();
@@ -371,7 +380,7 @@ TEST_P(NativeLoaderTest_Create, UnbundledProductApp) {
expected_permitted_path =
expected_permitted_path + ":/product/" LIB_DIR ":/system/product/" LIB_DIR;
expected_shared_libs_to_platform_ns =
- expected_shared_libs_to_platform_ns + ":" + llndk_libraries_product();
+ default_public_libraries() + ":" + llndk_libraries_product();
expected_link_with_vndk_product_ns = true;
}
SetExpectations();