From 2ed710976cb0ace31aab565c95a42d4e75623894 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 11 Nov 2013 15:48:06 -0800 Subject: [PATCH] Add extra regression tests for an already-fixed dynamic linker bug. Bug: https://code.google.com/p/android/issues/detail?id=61799 Change-Id: I84af68f8430a06e999297c2e57e06ecb45adf81e --- tests/dlfcn_test.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp index 6ba8e6636..fc90dd915 100644 --- a/tests/dlfcn_test.cpp +++ b/tests/dlfcn_test.cpp @@ -224,13 +224,21 @@ TEST(dlfcn, dlopen_bad_flags) { } TEST(dlfcn, rtld_default_unknown_symbol) { - void* self = RTLD_DEFAULT; - void* addr = dlsym(self, "ANY_UNKNOWN_SYMBOL_NAME"); + void* addr = dlsym(RTLD_DEFAULT, "ANY_UNKNOWN_SYMBOL_NAME"); ASSERT_TRUE(addr == NULL); } TEST(dlfcn, rtld_default_known_symbol) { - void* self = RTLD_DEFAULT; - void* addr = dlsym(self, "fopen"); + void* addr = dlsym(RTLD_DEFAULT, "fopen"); + ASSERT_TRUE(addr != NULL); +} + +TEST(dlfcn, rtld_next_unknown_symbol) { + void* addr = dlsym(RTLD_NEXT, "ANY_UNKNOWN_SYMBOL_NAME"); + ASSERT_TRUE(addr == NULL); +} + +TEST(dlfcn, rtld_next_known_symbol) { + void* addr = dlsym(RTLD_NEXT, "fopen"); ASSERT_TRUE(addr != NULL); }