Skip to content

Commit 6a50aa7

Browse files
authored
[lldb] Add linux test for the three-arg version of getProcFile (#146500)
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 032966f commit 6a50aa7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lldb/unittests/Host/posix/SupportTest.cpp

Lines changed: 15 additions & 4 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,10 +26,16 @@ TEST(Support, getProcFile_Pid) {
2126
}
2227
#endif // #ifndef __APPLE__
2328

24-
#if defined(_AIX) && defined(LLVM_ENABLE_THREADING)
29+
#if defined(_AIX) || defined(__linux__)
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
}
30-
#endif // #ifdef _AIX && LLVM_ENABLE_THREADING
41+
#endif // #if defined(_AIX) || defined(__linux__)

0 commit comments

Comments
 (0)