| 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-exception |
| 6 | // |
| 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 | #endif |
| 18 | |
| 19 | using namespace lldb_private; |
| 20 | |
| 21 | #ifndef __APPLE__ |
| 22 | TEST(Support, getProcFile_Pid) { |
| 23 | auto BufferOrError = getProcFile(pid: getpid(), file: "status"); |
| 24 | ASSERT_TRUE(BufferOrError); |
| 25 | ASSERT_TRUE(*BufferOrError); |
| 26 | } |
| 27 | #endif // #ifndef __APPLE__ |
| 28 | |
| 29 | #if defined(_AIX) || defined(__linux__) |
| 30 | TEST(Support, getProcFile_Tid) { |
| 31 | auto BufferOrError = getProcFile(pid: getpid(), tid: llvm::get_threadid(), |
| 32 | #ifdef _AIX |
| 33 | "lwpstatus" |
| 34 | #else |
| 35 | file: "status" |
| 36 | #endif |
| 37 | ); |
| 38 | ASSERT_TRUE(BufferOrError); |
| 39 | ASSERT_TRUE(*BufferOrError); |
| 40 | } |
| 41 | #endif // #if defined(_AIX) || defined(__linux__) |
| 42 |
