summaryrefslogtreecommitdiff
path: root/libnativeloader/native_loader_test.cpp
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2019-11-12 20:11:00 +0000
committerTreehugger Robot <treehugger-gerrit@google.com>2019-11-13 00:38:15 +0000
commitbe08b201e20900d590c235eb7a933ace2212ccbc (patch)
tree1932acf878722cc266601968e58ca1ebc51ee365 /libnativeloader/native_loader_test.cpp
parent48297337eb1e44b0d9a3c5e9211ef9080eb406a8 (diff)
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
Diffstat (limited to 'libnativeloader/native_loader_test.cpp')
-rw-r--r--libnativeloader/native_loader_test.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 3ce3ca9573..7fdb0c08e3 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -38,6 +38,12 @@ using ::testing::_;
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 @@ class NativeLoaderTest_Create : public NativeLoaderTest {
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 @@ TEST_P(NativeLoaderTest_Create, UnbundledVendorApp) {
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 @@ TEST_P(NativeLoaderTest_Create, UnbundledProductApp_post30) {
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 @@ TEST_P(NativeLoaderTest_Create, TwoApks) {
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";