diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2015-04-11 00:28:05 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-11 00:28:05 +0000 |
commit | de889741201faa338e01babdfd10bbd597769e60 (patch) | |
tree | 12166e0d22320706656a26e6ac4dd815c5eba8aa /tests | |
parent | c921eb677077f96c09c66ac34cad490356afde6c (diff) | |
parent | ef25592f14d23ce6294ea103e9edf894779d141d (diff) | |
download | bionic-de889741201faa338e01babdfd10bbd597769e60.zip bionic-de889741201faa338e01babdfd10bbd597769e60.tar.gz bionic-de889741201faa338e01babdfd10bbd597769e60.tar.bz2 |
Merge "Fix dl* tests to run-on-host"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dlext_test.cpp | 6 | ||||
-rw-r--r-- | tests/dlfcn_test.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp index 7012418..56a8f6f 100644 --- a/tests/dlext_test.cpp +++ b/tests/dlext_test.cpp @@ -134,6 +134,10 @@ TEST_F(DlExtTest, ExtInfoUseFdWithOffset) { TEST_F(DlExtTest, ExtInfoUseFdWithInvalidOffset) { const std::string lib_path = std::string(getenv("ANDROID_DATA")) + LIBZIPPATH; + // lib_path is relative when $ANDROID_DATA is relative + char lib_realpath_buf[PATH_MAX]; + ASSERT_TRUE(realpath(lib_path.c_str(), lib_realpath_buf) == lib_realpath_buf); + const std::string lib_realpath = std::string(lib_realpath_buf); android_dlextinfo extinfo; extinfo.flags = ANDROID_DLEXT_USE_LIBRARY_FD | ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET; @@ -158,7 +162,7 @@ TEST_F(DlExtTest, ExtInfoUseFdWithInvalidOffset) { extinfo.library_fd_offset = PAGE_SIZE; handle_ = android_dlopen_ext("libname_ignored", RTLD_NOW, &extinfo); ASSERT_TRUE(handle_ == nullptr); - ASSERT_EQ("dlopen failed: \"" + lib_path + "\" has bad ELF magic", dlerror()); + ASSERT_EQ("dlopen failed: \"" + lib_realpath + "\" has bad ELF magic", dlerror()); close(extinfo.library_fd); } diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp index 1d62428..708e2cd 100644 --- a/tests/dlfcn_test.cpp +++ b/tests/dlfcn_test.cpp @@ -764,7 +764,11 @@ TEST(dlfcn, dladdr_libc) { void* addr = reinterpret_cast<void*>(puts); // well-known libc function ASSERT_TRUE(dladdr(addr, &info) != 0); - ASSERT_STREQ(BIONIC_PATH_TO_LIBC, info.dli_fname); + // /system/lib is symlink when this test is executed on host. + char libc_realpath[PATH_MAX]; + ASSERT_TRUE(realpath(BIONIC_PATH_TO_LIBC, libc_realpath) == libc_realpath); + + ASSERT_STREQ(libc_realpath, info.dli_fname); // TODO: add check for dfi_fbase ASSERT_STREQ("puts", info.dli_sname); ASSERT_EQ(addr, info.dli_saddr); |