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

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


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

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

>From e782bbe26410515ad80d79bb9ed7ff8951ed4ca4 Mon Sep 17 00:00:00 2001
From: lizhijin <lizhijin3 at huawei.com>
Date: Tue, 8 Oct 2024 00:15:09 +0800
Subject: [PATCH] [rtsan] Ensure pthread is initialized in test

Handle running stuck of `pthread_cond_destroy` on X86
in test `PthreadCondSignalDiesWhenRealtime` and
`PthreadCondBroadcastDiesWhenRealtime`.
---
 compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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