[compiler-rt] b443711 - [rtsan] Ensure pthread is initialized in test (#111401)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 18:19:36 PDT 2024


Author: lizhijin1024
Date: 2024-10-08T09:19:32+08:00
New Revision: b44371194b101ed0d6f5ad8b764c1dc748020b7b

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

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

Handle running stuck of `pthread_cond_destroy` on X86 in test
`PthreadCondSignalDiesWhenRealtime` and
`PthreadCondBroadcastDiesWhenRealtime`.

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 c65b1bb01fbe01..f7a281f13e2ff6 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -539,7 +539,7 @@ TEST(TestRtsanInterceptors, SpinLockLockDiesWhenRealtime) {
 
 TEST(TestRtsanInterceptors, PthreadCondSignalDiesWhenRealtime) {
   pthread_cond_t cond{};
-  pthread_cond_init(&cond, NULL);
+  ASSERT_EQ(0, pthread_cond_init(&cond, nullptr));
 
   auto Func = [&cond]() { pthread_cond_signal(&cond); };
   ExpectRealtimeDeath(Func, "pthread_cond_signal");
@@ -550,7 +550,7 @@ TEST(TestRtsanInterceptors, PthreadCondSignalDiesWhenRealtime) {
 
 TEST(TestRtsanInterceptors, PthreadCondBroadcastDiesWhenRealtime) {
   pthread_cond_t cond{};
-  pthread_cond_init(&cond, NULL);
+  ASSERT_EQ(0, pthread_cond_init(&cond, nullptr));
 
   auto Func = [&cond]() { pthread_cond_broadcast(&cond); };
   ExpectRealtimeDeath(Func, "pthread_cond_broadcast");


        


More information about the llvm-commits mailing list