Merge "linker: add test for zeroed out shdr_table_"

This commit is contained in:
Treehugger Robot 2016-08-15 23:23:26 +00:00 committed by Gerrit Code Review
commit 3b2d331e77
6 changed files with 11 additions and 0 deletions

View file

@ -38,6 +38,9 @@ include $(LOCAL_PATH)/Android.build.prebuilt.mk
bionic_tests_module := libtest_invalid-zero_shdr_table_offset.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
bionic_tests_module := libtest_invalid-zero_shdr_table_content.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
build_host := true
else

View file

@ -1202,4 +1202,12 @@ TEST(dlfcn, dlopen_invalid_zero_shdr_table_offset) {
ASSERT_SUBSTR(expected_dlerror.c_str(), dlerror());
}
TEST(dlfcn, dlopen_invalid_zero_shdr_table_content) {
std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shdr_table_content.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" .dynamic section header was not found";
ASSERT_SUBSTR(expected_dlerror.c_str(), dlerror());
}
#endif