-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb][test] check if CoreDumping is supported at runtime #161385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
)" This reverts commit 02d8fb5.
@llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) Changes#160333 reimplementation but at runtime instead because of broken CI. Full diff: https://github.com/llvm/llvm-project/pull/161385.diff 1 Files Affected:
diff --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp
index dc75b288ba76a..d4f6d10ec5d3d 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -17,6 +17,8 @@
#ifdef __linux__
#include <linux/version.h>
+#include <sstream>
+#include <sys/utsname.h>
#endif // __linux__
using namespace lldb_private;
@@ -98,6 +100,28 @@ TEST_F(HostTest, GetProcessInfo) {
// Only linux currently sets these.
#ifdef __linux__
+
+int KernelVersion(int major, int minor, int patch) {
+ return KERNEL_VERSION(major, minor, patch);
+}
+
+std::optional<int> GetLinuxVersion() {
+ struct utsname buffer;
+
+ if (uname(&buffer) != 0)
+ return std::nullopt;
+
+ std::stringstream release(buffer.release);
+ int major = 0;
+ int minor = 0;
+ int patch = 0;
+ release >> major;
+ release >> minor;
+ release >> patch;
+
+ return KernelVersion(major, minor, patch);
+}
+
TEST_F(HostTest, GetProcessInfoSetsPriority) {
ProcessInstanceInfo Info;
struct rlimit rlim;
@@ -120,12 +144,15 @@ 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
+ std::optional<int> opt_linux_version = GetLinuxVersion();
+ if (opt_linux_version.has_value()) {
+
+ if (opt_linux_version.value() >= KernelVersion(4, 15, 0)) {
+ ASSERT_TRUE(Info.IsCoreDumping().has_value());
+ ASSERT_FALSE(Info.IsCoreDumping().value());
+ } else {
+ ASSERT_FALSE(Info.IsCoreDumping().has_value());
+ }
+ }
}
#endif
|
7d32216
to
598ac33
Compare
Co-authored-by: Michael Buch <michaelbuch12@gmail.com>
Lack of this patch is still causing problems in our LLDB CI, and it appears that the PR's test failure in presubmit should be trivial to fix. Do you think you'll be able to land this soon? We can probably polish and land it if need be. |
This is the PR CI:
Looks like we just need to change:
to
|
Correct typo
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/181/builds/29144 Here is the relevant piece of the build log for the reference
|
#160333 reimplementation but at runtime instead because of broken CI.