Skip to content

Commit 2b30e53

Browse files
committed
[lldb] Add linux test for the three-arg version of getProcFile
Also conditionalize the header includes. Not strictly necessary, but it's weird to include an aix header on non-aix builds, it makes clang-tidy complain, and breaks build systems which require you to declare all headers belonging to a library (aka bazel).
1 parent 67be4fe commit 2b30e53

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lldb/unittests/Host/posix/SupportTest.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "lldb/Host/posix/Support.h"
10-
#include "lldb/Host/aix/Support.h"
1110
#include "llvm/Support/Threading.h"
1211
#include "gtest/gtest.h"
1312

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+
1419
using namespace lldb_private;
1520

1621
#ifndef __APPLE__
@@ -21,9 +26,15 @@ TEST(Support, getProcFile_Pid) {
2126
}
2227
#endif // #ifndef __APPLE__
2328

24-
#if defined(_AIX) && defined(LLVM_ENABLE_THREADING)
29+
#if (defined(_AIX) || defined(__linux__)) && defined(LLVM_ENABLE_THREADING)
2530
TEST(Support, getProcFile_Tid) {
26-
auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(), "lwpstatus");
31+
auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(),
32+
#ifdef _AIX
33+
"lwpstatus"
34+
#else
35+
"status"
36+
#endif
37+
);
2738
ASSERT_TRUE(BufferOrError);
2839
ASSERT_TRUE(*BufferOrError);
2940
}

0 commit comments

Comments
 (0)