folly:thread_local_test: avoid test failure due to dlopen of *SAN-enabled binary...
authorJim Meyering <meyering@fb.com>
Sat, 2 Jul 2016 16:31:28 +0000 (09:31 -0700)
committerFacebook Github Bot 7 <facebook-github-bot-7-bot@fb.com>
Sat, 2 Jul 2016 16:38:22 +0000 (09:38 -0700)
Summary:
The ThreadLocal.SharedLibrary test would fail when compiled with any sanitizer.
Skip that test when any sanitizer is enabled.

Reviewed By: Mizuchi

Differential Revision: D3508099

fbshipit-source-id: 0419269f6454ee4edb93fe00b6f0e79756e609d0

folly/test/ThreadLocalTest.cpp

index aaa3794d452ab0f1523450a14219600a51a403b9..7a3dab1def48fa92b5bc275f48dbae7e212ea60c 100644 (file)
@@ -572,6 +572,12 @@ TEST(ThreadLocal, Fork2) {
   }
 }
 
+// Elide this test when using any sanitizer. Otherwise, the dlopen'ed code
+// would end up running without e.g., ASAN-initialized data structures and
+// failing right away.
+#if !defined FOLLY_SANITIZE_ADDRESS && !defined UNDEFINED_SANITIZER && \
+    !defined FOLLY_SANITIZE_THREAD
+
 TEST(ThreadLocal, SharedLibrary) {
   auto exe = fs::executable_path();
   auto lib = exe.parent_path() / "lib_thread_local_test.so";
@@ -613,6 +619,8 @@ TEST(ThreadLocal, SharedLibrary) {
   t2.join();
 }
 
+#endif
+
 namespace folly { namespace threadlocal_detail {
 struct PthreadKeyUnregisterTester {
   PthreadKeyUnregister p;