43 lines · cpp
1//===-- SupportTest.cpp ---------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "lldb/Host/posix/Support.h"10#include "llvm/Support/Threading.h"11#include "gtest/gtest.h"12 13#if defined(_AIX)14#include "lldb/Host/aix/Support.h"15#elif defined(__linux__)16#include "lldb/Host/linux/Support.h"17#endif18 19using namespace lldb_private;20 21#ifndef __APPLE__22TEST(Support, getProcFile_Pid) {23 auto BufferOrError = getProcFile(getpid(), "status");24 ASSERT_TRUE(BufferOrError);25 ASSERT_TRUE(*BufferOrError);26}27#endif // #ifndef __APPLE__28 29#if (defined(_AIX) || defined(__linux__)) && defined(LLVM_ENABLE_THREADING)30TEST(Support, getProcFile_Tid) {31 auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(),32#ifdef _AIX33 "lwpstatus"34#else35 "status"36#endif37 );38 ASSERT_TRUE(BufferOrError);39 ASSERT_TRUE(*BufferOrError);40}41#endif // #if (defined(_AIX) || defined(__linux__)) &&42 // defined(LLVM_ENABLE_THREADING)43