bionic-unit-tests: Create symlinks in runtime
Instead of creating symlinks in build time and then relying
on usage of adb sync (adb push follows symlinks) - create
them in test run time.
Test: mm && run bionic-unit-tests --gtest_filter=dl*:Dl*
Bug: http://b/22182538
Change-Id: I9d2a873e3ba303533c14ba5e3b779e4a67925462
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 34c4108..23b133b 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -17,15 +17,16 @@
#include <gtest/gtest.h>
#include <dlfcn.h>
-#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdint.h>
+#include <string.h>
#include "private/ScopeGuard.h"
#include <string>
+#include "dlfcn_symlink_support.h"
#include "utils.h"
#define ASSERT_SUBSTR(needle, haystack) \
@@ -1012,8 +1013,10 @@
}
TEST(dlfcn, dlopen_symlink) {
+ DlfcnSymlink symlink("dlopen_symlink");
+ const std::string symlink_name = basename(symlink.get_symlink_path().c_str());
void* handle1 = dlopen("libdlext_test.so", RTLD_NOW);
- void* handle2 = dlopen("libdlext_test_v2.so", RTLD_NOW);
+ void* handle2 = dlopen(symlink_name.c_str(), RTLD_NOW);
ASSERT_TRUE(handle1 != nullptr);
ASSERT_TRUE(handle2 != nullptr);
ASSERT_EQ(handle1, handle2);