Merge "Test dlopen with symlinked .so files"
This commit is contained in:
commit
29d10e3de8
@ -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…
x
Reference in New Issue
Block a user