From 9bc487c0d5c726306c9d28678c836597b77e23a6 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Sat, 4 Oct 2025 00:17:16 +0100 Subject: [PATCH] [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 Co-authored-by: Daniel Thornburgh (cherry picked from commit c488dca6564d11ae84fb482599996a9d310f370d) --- lldb/unittests/Host/posix/HostTest.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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 #include -#ifdef __linux__ -#include -#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