From 442584e7897a6a0117c53818564494ba936dbf12 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Mon, 23 Nov 2015 18:45:15 -0800 Subject: [PATCH] Fix Build: folly/test/ThreadLocalTest Summary: [Folly] Fix Build: `folly/test/ThreadLocalTest`. The problem is that the to the shared lib used in the test is hardcoded. It's a relative path, so that's nice, but it has too many assumptions about where the build system deposits test binaries. Instead, let the code simply look for the shared lib in the same directory as the test binary. This makes fewer assumptions on the build system. Reviewed By: andriigrynenko Differential Revision: D2689047 fb-gh-sync-id: 648da079b7af5bc9893709d009e577347dd4a463 --- folly/test/ThreadLocalTest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/folly/test/ThreadLocalTest.cpp b/folly/test/ThreadLocalTest.cpp index 823c6cb5..1f089fa6 100644 --- a/folly/test/ThreadLocalTest.cpp +++ b/folly/test/ThreadLocalTest.cpp @@ -39,6 +39,7 @@ #include #include +#include using namespace folly; @@ -541,10 +542,10 @@ TEST(ThreadLocal, Fork2) { } } -TEST(ThreadLocal, SharedLibrary) -{ - auto handle = dlopen("./_bin/folly/test/lib_thread_local_test.so", - RTLD_LAZY); +TEST(ThreadLocal, SharedLibrary) { + auto exe = fs::executable_path(); + auto lib = exe.parent_path() / "lib_thread_local_test.so"; + auto handle = dlopen(lib.string().c_str(), RTLD_LAZY); EXPECT_NE(nullptr, handle); typedef void (*useA_t)(); -- 2.34.1