xref: /llvm-project/libc/test/integration/src/pthread/pthread_join_test.cpp (revision b6bc9d72f65a5086f310f321e969d96e9a559e75)
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 
17 static void *simpleFunc(void *) { return nullptr; }
18 static void nullJoinTest() {
19   pthread_t Tid;
20   ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&Tid, nullptr, simpleFunc, nullptr),
21             0);
22   ASSERT_EQ(libc_errno, 0);
23   ASSERT_EQ(LIBC_NAMESPACE::pthread_join(Tid, nullptr), 0);
24   ASSERT_EQ(libc_errno, 0);
25 }
26 
27 TEST_MAIN() {
28   libc_errno = 0;
29   nullJoinTest();
30   return 0;
31 }
32