diff --git a/tests/Android.mk b/tests/Android.mk index 785a9f1da..10e288c5e 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -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 \ diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp index fc90dd915..1fdecdbeb 100644 --- a/tests/dlfcn_test.cpp +++ b/tests/dlfcn_test.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); +}