From 22b6056a1b2bae1666461fd56774016096324248 Mon Sep 17 00:00:00 2001 From: Chris Apple Date: Tue, 10 Sep 2024 08:00:44 -0700 Subject: [PATCH] [rtsan] Ensure pthread is initialized in test --- .../lib/rtsan/tests/rtsan_test_interceptors.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp index 0eeaf9da67098..1ef4c66a28de8 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);