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

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 09:33:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: None (lizhijin1024)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/111401.diff


1 Files Affected:

- (modified) compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp (+2-2) 


``````````diff
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");

``````````

</details>


https://github.com/llvm/llvm-project/pull/111401


More information about the llvm-commits mailing list