Fix libnativeloader_test to work on 64 bit architectures.
Test: atest -a libnativeloader_test (on taimen, testing both arm64-v8a and armeabi-v7a)
Bug: 142896688
Change-Id: I90e24b6da8f02ff57d498685312709ac3c598e68
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 3ce3ca9..7fdb0c0 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -38,6 +38,12 @@
using internal::ConfigEntry;
using internal::ParseConfig;
+#if defined(__LP64__)
+#define LIB_DIR "lib64"
+#else
+#define LIB_DIR "lib"
+#endif
+
// gmock interface that represents interested platform APIs on libdl and libnativebridge
class Platform {
public:
@@ -331,8 +337,8 @@
std::string class_loader = "my_classloader";
bool is_shared = false;
std::string dex_path = "/data/app/foo/classes.dex";
- std::string library_path = "/data/app/foo/lib/arm";
- std::string permitted_path = "/data/app/foo/lib";
+ std::string library_path = "/data/app/foo/" LIB_DIR "/arm";
+ std::string permitted_path = "/data/app/foo/" LIB_DIR;
// expected output (.. for the default test inputs)
std::string expected_namespace_name = "classloader-namespace";
@@ -457,8 +463,8 @@
is_shared = false;
expected_namespace_name = "vendor-classloader-namespace";
- expected_library_path = expected_library_path + ":/vendor/lib";
- expected_permitted_path = expected_permitted_path + ":/vendor/lib";
+ 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();
expected_link_with_vndk_ns = true;
@@ -498,8 +504,9 @@
target_sdk_version = 30;
expected_namespace_name = "vendor-classloader-namespace";
- expected_library_path = expected_library_path + ":/product/lib:/system/product/lib";
- expected_permitted_path = expected_permitted_path + ":/product/lib:/system/product/lib";
+ expected_library_path = expected_library_path + ":/product/" LIB_DIR ":/system/product/" LIB_DIR;
+ 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();
expected_link_with_vndk_ns = true;
@@ -529,8 +536,8 @@
const std::string second_app_class_loader = "second_app_classloader";
const bool second_app_is_shared = false;
const std::string second_app_dex_path = "/data/app/bar/classes.dex";
- const std::string second_app_library_path = "/data/app/bar/lib/arm";
- const std::string second_app_permitted_path = "/data/app/bar/lib";
+ const std::string second_app_library_path = "/data/app/bar/" LIB_DIR "/arm";
+ const std::string second_app_permitted_path = "/data/app/bar/" LIB_DIR;
const std::string expected_second_app_permitted_path =
std::string("/data:/mnt/expand:") + second_app_permitted_path;
const std::string expected_second_app_parent_namespace = "classloader-namespace";