Skip to content

[lldb] Add linux test for the three-arg version of getProcFile #146500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2025

Conversation

labath
Copy link
Collaborator

@labath labath commented Jul 1, 2025

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).

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).
@llvmbot
Copy link
Member

llvmbot commented Jul 1, 2025

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes

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).


Full diff: https://github.com/llvm/llvm-project/pull/146500.diff

1 Files Affected:

  • (modified) lldb/unittests/Host/posix/SupportTest.cpp (+14-3)
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);
 }

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@labath labath merged commit 6a50aa7 into llvm:main Jul 3, 2025
7 checks passed
@labath labath deleted the support branch July 3, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants