https://github.com/da-viper created 
https://github.com/llvm/llvm-project/pull/160333

CoreDumping in /proc/pid/stat was added in kernel 4.15, this causes the test to 
fail in older kernel versions. see 
https://man7.org/linux/man-pages/man5/proc_pid_status.5.html

>From a4f055b6d6794fca3f09e128d5f809afab8cd715 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <[email protected]>
Date: Tue, 23 Sep 2025 16:46:42 +0100
Subject: [PATCH] [lldb][test] check if CoreDumping info is supported

CoreDumping in /proc/pid/stat was added in kernel 4.15, this causes the test to 
fail in older versions.
see https://man7.org/linux/man-pages/man5/proc_pid_status.5.html
---
 lldb/unittests/Host/posix/HostTest.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lldb/unittests/Host/posix/HostTest.cpp 
b/lldb/unittests/Host/posix/HostTest.cpp
index 082edccf4e774..7bb44c99bc998 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -15,6 +15,10 @@
 #include <cerrno>
 #include <sys/resource.h>
 
+#ifdef __linux__
+#include <linux/version.h>
+#endif // __linux__
+
 using namespace lldb_private;
 
 namespace {
@@ -116,7 +120,12 @@ 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
 }
 #endif

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to