Test dlopen with symlinked .so files
Bug: 9741592 Change-Id: I68c59d6f4e690136395c3dc3de13f99ce38de528
This commit is contained in:
parent
b696452488
commit
7db180919c
|
@ -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 \
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue