Add another test for weak-reference

  This one covers undefined weak reference in .so
  referenced via JUMP_SLOT relocation.

Bug: 17526061
Change-Id: Ib8764bd30c1f686c4818ebbc6683cf42dee908b2
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, 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 @@
   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);