Skip to content

Commit 02d8fb5

Browse files
authored
[lldb][test] check if CoreDumping info is supported (#160333)
CoreDumping in /proc/<pid>/status 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
1 parent c8d983c commit 02d8fb5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lldb/unittests/Host/posix/HostTest.cpp

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

18+
#ifdef __linux__
19+
#include <linux/version.h>
20+
#endif // __linux__
21+
1822
using namespace lldb_private;
1923

2024
namespace {
@@ -116,7 +120,12 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
116120
ASSERT_TRUE(Info.IsZombie().has_value());
117121
ASSERT_FALSE(Info.IsZombie().value());
118122

123+
// CoreDumping was added in kernel version 4.15.
124+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
119125
ASSERT_TRUE(Info.IsCoreDumping().has_value());
120126
ASSERT_FALSE(Info.IsCoreDumping().value());
127+
#else
128+
ASSERT_FALSE(Info.IsCoreDumping().has_value());
129+
#endif
121130
}
122131
#endif

0 commit comments

Comments
 (0)