Merge "linker: add test for empty shdr table"

am: ac69db1f85

Change-Id: Ib72a58f9f3e07cb136cdf01e2e073b389d77c62e
This commit is contained in:
Dimitry Ivanov 2016-08-15 20:17:17 +00:00 committed by android-build-merger
commit 68418746f2
6 changed files with 11 additions and 0 deletions

View file

@ -32,6 +32,9 @@ include $(LOCAL_PATH)/Android.build.prebuilt.mk
bionic_tests_module := libtest_invalid-zero_shstrndx.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
bionic_tests_module := libtest_invalid-empty_shdr_table.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

@ -1186,4 +1186,12 @@ TEST(dlfcn, dlopen_invalid_zero_shstrndx) {
ASSERT_STREQ(expected_dlerror.c_str(), dlerror());
}
TEST(dlfcn, dlopen_invalid_empty_shdr_table) {
std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-empty_shdr_table.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has no section headers";
ASSERT_STREQ(expected_dlerror.c_str(), dlerror());
}
#endif