diff --git a/kernel_lite/process_posix/src/ActsProcessApiTest.cpp b/kernel_lite/process_posix/src/ActsProcessApiTest.cpp index f9dc9470b443b1686ca663acabc808aa47a47688..30ddd6ba9be32d9c46e60eb8d5d04c121a154ed9 100755 --- a/kernel_lite/process_posix/src/ActsProcessApiTest.cpp +++ b/kernel_lite/process_posix/src/ActsProcessApiTest.cpp @@ -223,6 +223,7 @@ HWTEST_F(ActsProcessApiTest, testPthreadSetnameNp1100, Function | MediumTest | L << "ErrInfo: pthread_setname_np thread:='" << newThread << "(0x" << newThread << ")' *name:='fThreadName'," << " --> returnVal:='" << returnVal << "'"; + EXPECT_EQ(pthread_join(newThread, nullptr), 0) << "pthread join errno = " << errno; } /** @@ -263,4 +264,5 @@ HWTEST_F(ActsProcessApiTest, testPthreadAttrGetguardsize0100, Function | MediumT EXPECT_EQ(guardsize, 4096) << "ErrInfo: pthread_attr_getguardsize attr:='&threadAttr' guardsize:='&guardsize'," << " --> returnVal:='" << returnVal << "', guardsize:='" << guardsize << "'"; + EXPECT_EQ(pthread_join(newThread, nullptr), 0) << "pthread join errno = " << errno; } diff --git a/kernel_lite/process_posix/src/PthreadAttrTest.cpp b/kernel_lite/process_posix/src/PthreadAttrTest.cpp index 4776fc31f61ccaaba40e8969947f13b5a2358d27..09452811a0fe12582b0aa8f797c6df10443d7745 100755 --- a/kernel_lite/process_posix/src/PthreadAttrTest.cpp +++ b/kernel_lite/process_posix/src/PthreadAttrTest.cpp @@ -93,7 +93,7 @@ HWTEST_F(PthreadTest, testPthreadAttrSetscope, Function | MediumTest | Level3) ASSERT_EQ(pthread_create(&tid, &attr, ThreadPthreadAttrSetscope, nullptr), 0) << "> return errno"; Msleep(20); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(pthread_attr_destroy(&attr), 0); } @@ -133,7 +133,7 @@ HWTEST_F(PthreadTest, testPthreadAttrSetguardsize, Function | MediumTest | Level ASSERT_EQ(pthread_create(&tid, &attr, ThreadPthreadAttrSetguardsize, nullptr), 0) << "> return errno"; Msleep(20); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(pthread_attr_destroy(&attr), 0); } @@ -176,7 +176,7 @@ HWTEST_F(PthreadTest, testPthreadAttrSetstacksize, Function | MediumTest | Level ASSERT_EQ(pthread_create(&tid, &attr, ThreadPthreadAttrSetstacksize, nullptr), 0) << "> return errno"; Msleep(20); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(pthread_attr_destroy(&attr), 0); } @@ -241,7 +241,7 @@ HWTEST_F(PthreadTest, testPthreadAttrSetstack, Function | MediumTest | Level3) EXPECT_EQ(pthread_create(&tid, &attr, ThreadPthreadAttrSetstack, stackAddr), 0) << "> return errno"; Msleep(100); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(pthread_attr_destroy(&attr), 0); } @@ -296,5 +296,5 @@ HWTEST_F(PthreadTest, testPthreadGetattrNp, Function | MediumTest | Level3) pthread_t tid; EXPECT_EQ(pthread_create(&tid, nullptr, ThreadPthreadGetattrNp, nullptr), 0) << "> return errno"; Msleep(100); - pthread_cancel(tid); + pthread_join(tid, nullptr); } diff --git a/kernel_lite/process_posix/src/PthreadBasicApiTest.cpp b/kernel_lite/process_posix/src/PthreadBasicApiTest.cpp index 704bbd87a403b7f821b0ca04adfa1fc49656f0c1..ab9d4eb9705bd9d6c8324fed9e047acef22a6a1d 100755 --- a/kernel_lite/process_posix/src/PthreadBasicApiTest.cpp +++ b/kernel_lite/process_posix/src/PthreadBasicApiTest.cpp @@ -308,7 +308,9 @@ HWTEST_F(PthreadTest, testPthreadSpecificAll, Function | MediumTest | Level3) ASSERT_EQ(pthread_create(&tid2, nullptr, ThreadPthreadSpecificAll, nullptr), 0) << "> return errno"; Msleep(100); pthread_cancel(tid1); + pthread_join(tid1, nullptr); pthread_cancel(tid2); + pthread_join(tid2, nullptr); EXPECT_EQ(g_intPthreadSpecificAll, 5); } @@ -340,7 +342,7 @@ HWTEST_F(PthreadTest, testPthreadSpecificAllDelete, Function | MediumTest | Leve pthread_t tid; ASSERT_EQ(pthread_create(&tid, nullptr, ThreadPthreadSpecificAllDelete, (void*)&data), 0) << "> return errno"; Msleep(100); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(data, 1); } @@ -374,7 +376,7 @@ HWTEST_F(PthreadTest, testPthreadCleanupPushPopBasic, Function | MediumTest | Le CheckStep(1); ASSERT_EQ(pthread_create(&tid, nullptr, ThreadTestPush, nullptr), 0) << "> return errno"; Msleep(100); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(CheckStep(4), (uint64_t)0x1234); } @@ -404,7 +406,7 @@ HWTEST_F(PthreadTest, testPthreadCleanupPushPopParam, Function | MediumTest | Le CheckStep(1); ASSERT_EQ(pthread_create(&tid, nullptr, ThreadTestPushParam, nullptr), 0) << "> return errno"; Msleep(100); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(CheckStep(3), (uint64_t)0x123); } @@ -439,7 +441,7 @@ HWTEST_F(PthreadTest, testPop, Function | MediumTest | Level3) CheckStep(1); ASSERT_EQ(pthread_create(&tid, nullptr, ThreadTestop, nullptr), 0) << "> return errno"; Msleep(100); - pthread_cancel(tid); + pthread_join(tid, nullptr); EXPECT_EQ(CheckStep(3), (uint64_t)0x123); } @@ -525,8 +527,8 @@ HWTEST_F(PthreadTest, testBarrierWait, Function | MediumTest | Level3) ADD_FAILURE(); } Msleep(50); - pthread_cancel(tid); - pthread_cancel(tid1); + pthread_join(tid, nullptr); + pthread_join(tid1, nullptr); EXPECT_EQ(pthread_barrier_destroy(&g_barrier), 0) << "> return errno"; EXPECT_EQ(CheckStep(3), (uint64_t)0x123); EXPECT_EQ(intParam, 2); @@ -567,8 +569,8 @@ HWTEST_F(PthreadTest, testBarrierAlwaysWait, Function | MediumTest | Level3) if ((reInt != PTHREAD_BARRIER_SERIAL_THREAD) && (reInt != 0)) { ADD_FAILURE(); } - pthread_cancel(tid); - pthread_cancel(tid1); + pthread_join(tid, nullptr); + pthread_join(tid1, nullptr); EXPECT_EQ(pthread_barrier_destroy(&barrier), 0) << "> return errno"; }