[Lldb-commits] [lldb] c488dca - [lldb][test] check if CoreDumping is supported at runtime (#161385)

via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 3 16:17:20 PDT 2025


Author: Ebuka Ezike
Date: 2025-10-03T16:17:16-07:00
New Revision: c488dca6564d11ae84fb482599996a9d310f370d

URL: https://github.com/llvm/llvm-project/commit/c488dca6564d11ae84fb482599996a9d310f370d
DIFF: https://github.com/llvm/llvm-project/commit/c488dca6564d11ae84fb482599996a9d310f370d.diff

LOG: [lldb][test] check if CoreDumping is supported at runtime  (#161385)

#160333 reimplementation but at runtime instead because of broken CI.

---------

Co-authored-by: Michael Buch <michaelbuch12 at gmail.com>
Co-authored-by: Daniel Thornburgh <mysterymath at gmail.com>

Added: 
    

Modified: 
    lldb/unittests/Host/posix/HostTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp
index dc75b288ba76a..7135f266a3507 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -15,10 +15,6 @@
 #include <cerrno>
 #include <sys/resource.h>
 
-#ifdef __linux__
-#include <linux/version.h>
-#endif // __linux__
-
 using namespace lldb_private;
 
 namespace {
@@ -120,12 +116,13 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
   ASSERT_TRUE(Info.IsZombie().has_value());
   ASSERT_FALSE(Info.IsZombie().value());
 
-  // CoreDumping was added in kernel version 4.15.
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
-  ASSERT_TRUE(Info.IsCoreDumping().has_value());
-  ASSERT_FALSE(Info.IsCoreDumping().value());
-#else
-  ASSERT_FALSE(Info.IsCoreDumping().has_value());
-#endif
+  const llvm::VersionTuple host_version = HostInfo::GetOSVersion();
+  ASSERT_FALSE(host_version.empty());
+  if (host_version >= llvm::VersionTuple(4, 15, 0)) {
+    ASSERT_TRUE(Info.IsCoreDumping().has_value());
+    ASSERT_FALSE(Info.IsCoreDumping().value());
+  } else {
+    ASSERT_FALSE(Info.IsCoreDumping().has_value());
+  }
 }
 #endif


        


More information about the lldb-commits mailing list