llvm-project/libc/test/integration/src/pthread/pthread_join_test.cpp
michaelrj-google 3eb1e6d8e9
[libc] Move libc_errno inside of LIBC_NAMESPACE (#80774)
Having libc_errno outside of the namespace causes versioning issues when
trying to link the tests against LLVM-libc. Most of this patch is just
moving libc_errno inside the namespace in tests. This isn't necessary in
the function implementations since those are already inside the
namespace.
2024-02-06 10:36:05 +01:00

32 lines
934 B
C++

//===-- Tests for pthread_join-- ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "src/pthread/pthread_create.h"
#include "src/pthread/pthread_join.h"
#include "src/errno/libc_errno.h"
#include "test/IntegrationTest/test.h"
#include <pthread.h>
static void *simpleFunc(void *) { return nullptr; }
static void nullJoinTest() {
pthread_t Tid;
ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&Tid, nullptr, simpleFunc, nullptr),
0);
ASSERT_ERRNO_SUCCESS();
ASSERT_EQ(LIBC_NAMESPACE::pthread_join(Tid, nullptr), 0);
ASSERT_ERRNO_SUCCESS();
}
TEST_MAIN() {
LIBC_NAMESPACE::libc_errno = 0;
nullJoinTest();
return 0;
}