Skip to content

Commit c488dca

Browse files
da-viperMichael137mysterymath
authored
[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 <[email protected]> Co-authored-by: Daniel Thornburgh <[email protected]>
1 parent 162b87b commit c488dca

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lldb/unittests/Host/posix/HostTest.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
#include <cerrno>
1616
#include <sys/resource.h>
1717

18-
#ifdef __linux__
19-
#include <linux/version.h>
20-
#endif // __linux__
21-
2218
using namespace lldb_private;
2319

2420
namespace {
@@ -120,12 +116,13 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
120116
ASSERT_TRUE(Info.IsZombie().has_value());
121117
ASSERT_FALSE(Info.IsZombie().value());
122118

123-
// CoreDumping was added in kernel version 4.15.
124-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
125-
ASSERT_TRUE(Info.IsCoreDumping().has_value());
126-
ASSERT_FALSE(Info.IsCoreDumping().value());
127-
#else
128-
ASSERT_FALSE(Info.IsCoreDumping().has_value());
129-
#endif
119+
const llvm::VersionTuple host_version = HostInfo::GetOSVersion();
120+
ASSERT_FALSE(host_version.empty());
121+
if (host_version >= llvm::VersionTuple(4, 15, 0)) {
122+
ASSERT_TRUE(Info.IsCoreDumping().has_value());
123+
ASSERT_FALSE(Info.IsCoreDumping().value());
124+
} else {
125+
ASSERT_FALSE(Info.IsCoreDumping().has_value());
126+
}
130127
}
131128
#endif

0 commit comments

Comments
 (0)