1 //===-- Tests for pthread_join-- ------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "src/pthread/pthread_create.h" 10 #include "src/pthread/pthread_join.h" 11 12 #include "src/errno/libc_errno.h" 13 14 #include "test/IntegrationTest/test.h" 15 #include <pthread.h> 16 simpleFunc(void *)17static void *simpleFunc(void *) { return nullptr; } nullJoinTest()18static void nullJoinTest() { 19 pthread_t Tid; 20 ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&Tid, nullptr, simpleFunc, nullptr), 21 0); 22 ASSERT_ERRNO_SUCCESS(); 23 ASSERT_EQ(LIBC_NAMESPACE::pthread_join(Tid, nullptr), 0); 24 ASSERT_ERRNO_SUCCESS(); 25 } 26 TEST_MAIN()27TEST_MAIN() { 28 LIBC_NAMESPACE::libc_errno = 0; 29 nullJoinTest(); 30 return 0; 31 } 32