[compiler-rt] 0b12cd2 - [rtsan] Ensure pthread is initialized in test (#108040)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 13:02:19 PDT 2024


Author: Chris Apple
Date: 2024-09-10T13:02:15-07:00
New Revision: 0b12cd227e593f5518da5170a399730bb314223e

URL: https://github.com/llvm/llvm-project/commit/0b12cd227e593f5518da5170a399730bb314223e
DIFF: https://github.com/llvm/llvm-project/commit/0b12cd227e593f5518da5170a399730bb314223e.diff

LOG: [rtsan] Ensure pthread is initialized in test (#108040)

Added: 
    

Modified: 
    compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
index 0eeaf9da67098e..1ef4c66a28de88 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -472,11 +472,12 @@ TEST_F(PthreadMutexLockTest, PthreadMutexUnlockSurvivesWhenNotRealtime) {
   ExpectNonRealtimeSurvival(Func);
 }
 
-TEST(TestRtsanInterceptors, PthreadMutexJoinDiesWhenRealtime) {
-  auto Func = []() {
-    pthread_t thread{};
-    pthread_join(thread, nullptr);
-  };
+TEST(TestRtsanInterceptors, PthreadJoinDiesWhenRealtime) {
+  pthread_t thread{};
+  ASSERT_EQ(0,
+            pthread_create(&thread, nullptr, &FakeThreadEntryPoint, nullptr));
+
+  auto Func = [&thread]() { pthread_join(thread, nullptr); };
 
   ExpectRealtimeDeath(Func, "pthread_join");
   ExpectNonRealtimeSurvival(Func);


        


More information about the llvm-commits mailing list