Merge "Test dlopen with symlinked .so files"

This commit is contained in:
Dmitriy Ivanov 2014-05-09 00:52:07 +00:00 committed by Gerrit Code Review
commit 29d10e3de8
2 changed files with 21 additions and 0 deletions

View File

@ -212,6 +212,19 @@ build_type := target
build_target := SHARED_LIBRARY
include $(LOCAL_PATH)/Android.build.mk
# -----------------------------------------------------------------------------
# create symlink to libdlext_test.so for symlink test
# -----------------------------------------------------------------------------
libdlext_origin := $(LOCAL_INSTALLED_MODULE)
libdlext_sym := $(subst libdlext_test,libdlext_test_v2,$(libdlext_origin))
$(libdlext_sym): $(libdlext_origin)
@echo "Symlink: $@ -> $(notdir $<)"
@mkdir -p $(dir $@)
$(hide) ln -sf $(notdir $<) $@
ALL_MODULES := \
$(ALL_MODULES) $(libdlext_sym)
libdlext_test_norelro_src_files := \
dlext_test_library.cpp \

View File

@ -242,3 +242,11 @@ TEST(dlfcn, rtld_next_known_symbol) {
void* addr = dlsym(RTLD_NEXT, "fopen");
ASSERT_TRUE(addr != NULL);
}
TEST(dlfcn, dlopen_symlink) {
void* handle1 = dlopen("libdlext_test.so", RTLD_NOW);
void* handle2 = dlopen("libdlext_test_v2.so", RTLD_NOW);
ASSERT_TRUE(handle1 != NULL);
ASSERT_TRUE(handle2 != NULL);
ASSERT_EQ(handle1, handle2);
}