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
#include <folly/Benchmark.h>
#include <folly/Baton.h>
+#include <folly/experimental/io/FsUtil.h>
using namespace folly;
}
}
-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)();