summaryrefslogtreecommitdiffstats
path: root/tests/dlfcn_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dlfcn_test.cpp')
-rw-r--r--tests/dlfcn_test.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index c988d29..6fdfdc7 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -819,7 +819,7 @@ TEST(dlfcn, rtld_next_known_symbol) {
TEST(dlfcn, dlsym_weak_func) {
dlerror();
- void* handle = dlopen("libtest_dlsym_weak_func.so",RTLD_NOW);
+ void* handle = dlopen("libtest_dlsym_weak_func.so", RTLD_NOW);
ASSERT_TRUE(handle != NULL);
int (*weak_func)();
@@ -829,6 +829,18 @@ TEST(dlfcn, dlsym_weak_func) {
dlclose(handle);
}
+TEST(dlfcn, dlopen_undefined_weak_func) {
+ test_isolated([] {
+ void* handle = dlopen("libtest_dlopen_weak_undefined_func.so", RTLD_NOW);
+ ASSERT_TRUE(handle != nullptr) << dlerror();
+ int (*weak_func)();
+ weak_func = reinterpret_cast<int (*)()>(dlsym(handle, "use_weak_undefined_func"));
+ ASSERT_TRUE(weak_func != nullptr) << dlerror();
+ EXPECT_EQ(6551, weak_func());
+ dlclose(handle);
+ });
+}
+
TEST(dlfcn, dlopen_symlink) {
void* handle1 = dlopen("libdlext_test.so", RTLD_NOW);
void* handle2 = dlopen("libdlext_test_v2.so", RTLD_NOW);