[Lldb-commits] [lldb] [lldb] Add linux test for the three-arg version of getProcFile (PR #146500)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 1 03:50:33 PDT 2025
https://github.com/labath updated https://github.com/llvm/llvm-project/pull/146500
>From 2b30e53ff0c1d03e3acfd10c06863463a99dec60 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Tue, 1 Jul 2025 12:06:23 +0200
Subject: [PATCH 1/2] [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).
---
lldb/unittests/Host/posix/SupportTest.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/lldb/unittests/Host/posix/SupportTest.cpp b/lldb/unittests/Host/posix/SupportTest.cpp
index e4d7ba89fece6..6999128e43e36 100644
--- a/lldb/unittests/Host/posix/SupportTest.cpp
+++ b/lldb/unittests/Host/posix/SupportTest.cpp
@@ -7,10 +7,15 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/posix/Support.h"
-#include "lldb/Host/aix/Support.h"
#include "llvm/Support/Threading.h"
#include "gtest/gtest.h"
+#if defined(_AIX)
+#include "lldb/Host/aix/Support.h"
+#elif defined(__linux__)
+#include "lldb/Host/linux/Support.h"
+#endif
+
using namespace lldb_private;
#ifndef __APPLE__
@@ -21,9 +26,15 @@ TEST(Support, getProcFile_Pid) {
}
#endif // #ifndef __APPLE__
-#if defined(_AIX) && defined(LLVM_ENABLE_THREADING)
+#if (defined(_AIX) || defined(__linux__)) && defined(LLVM_ENABLE_THREADING)
TEST(Support, getProcFile_Tid) {
- auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(), "lwpstatus");
+ auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(),
+#ifdef _AIX
+ "lwpstatus"
+#else
+ "status"
+#endif
+ );
ASSERT_TRUE(BufferOrError);
ASSERT_TRUE(*BufferOrError);
}
>From 7b650567b9945977b887e90f0a2ff87947f765a0 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Tue, 1 Jul 2025 12:50:02 +0200
Subject: [PATCH 2/2] fix preprocessor
---
lldb/unittests/Host/posix/SupportTest.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lldb/unittests/Host/posix/SupportTest.cpp b/lldb/unittests/Host/posix/SupportTest.cpp
index 6999128e43e36..5393ad83ad8ac 100644
--- a/lldb/unittests/Host/posix/SupportTest.cpp
+++ b/lldb/unittests/Host/posix/SupportTest.cpp
@@ -26,7 +26,7 @@ TEST(Support, getProcFile_Pid) {
}
#endif // #ifndef __APPLE__
-#if (defined(_AIX) || defined(__linux__)) && defined(LLVM_ENABLE_THREADING)
+#if defined(_AIX) || defined(__linux__)
TEST(Support, getProcFile_Tid) {
auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(),
#ifdef _AIX
@@ -38,4 +38,4 @@ TEST(Support, getProcFile_Tid) {
ASSERT_TRUE(BufferOrError);
ASSERT_TRUE(*BufferOrError);
}
-#endif // #ifdef _AIX && LLVM_ENABLE_THREADING
+#endif // #if defined(_AIX) || defined(__linux__)
More information about the lldb-commits
mailing list