Skip to content

Conversation

da-viper
Copy link
Contributor

#160333 reimplementation but at runtime instead because of broken CI.

@llvmbot
Copy link
Member

llvmbot commented Sep 30, 2025

@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:

  • (modified) lldb/unittests/Host/posix/HostTest.cpp (+34-7)
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

@mysterymath
Copy link
Contributor

mysterymath commented Oct 3, 2025

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.

@Michael137
Copy link
Member

Michael137 commented Oct 3, 2025

This is the PR CI:

2025-10-03T10:01:50.6109918Z /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-assertion-result.h:161:9: error: no viable conversion from 'const llvm::VersionTuple' to 'bool'
2025-10-03T10:01:50.6111607Z   161 |       : success_(success) {}
2025-10-03T10:01:50.6112080Z       |         ^        ~~~~~~~
2025-10-03T10:01:50.6113979Z /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/Host/posix/HostTest.cpp:120:3: note: in instantiation of function template specialization 'testing::AssertionResult::AssertionResult<llvm::VersionTuple>' requested here
2025-10-03T10:01:50.6115969Z   120 |   ASSERT_TRUE(host_version);
2025-10-03T10:01:50.6116436Z       |   ^
2025-10-03T10:01:50.6117663Z /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1815:32: note: expanded from macro 'ASSERT_TRUE'
2025-10-03T10:01:50.6119124Z  1815 | #define ASSERT_TRUE(condition) GTEST_ASSERT_TRUE(condition)
2025-10-03T10:01:50.6120506Z       |                                ^
2025-10-03T10:01:50.6121900Z /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1798:3: note: expanded from macro 'GTEST_ASSERT_TRUE'
2025-10-03T10:01:50.6123500Z  1798 |   GTEST_TEST_BOOLEAN_(condition, #condition, false, true, GTEST_FATAL_FAILURE_)
2025-10-03T10:01:50.6124196Z       |   ^
2025-10-03T10:01:50.6125550Z /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-internal.h:1493:11: note: expanded from macro 'GTEST_TEST_BOOLEAN_'
2025-10-03T10:01:50.6127425Z  1493 |           ::testing::AssertionResult(expression))                     \
2025-10-03T10:01:50.6128041Z       |           ^
2025-10-03T10:01:50.6128400Z 1 error generated.

Looks like we just need to change:

ASSERT_TRUE(host_version);

to

ASSERT_FALSE(host_version.empty());

Correct typo
@mysterymath mysterymath merged commit c488dca into llvm:main Oct 3, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu running on doug-worker-1a while building lldb at step 6 "test-build-unified-tree-check-cross-project".

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
Step 6 (test-build-unified-tree-check-cross-project) failure: test (failure)
******************** TEST 'cross-project-tests :: debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
clang++ -O0 -glldb -std=gnu++11 /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/Output/unreachable_on_line.cpp.tmp # RUN: at line 8
+ clang++ -O0 -glldb -std=gnu++11 /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/Output/unreachable_on_line.cpp.tmp
not "/usr/bin/python3.8" "/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py" test --fail-lt 1.0 -w -v --debugger lldb-dap --lldb-executable "/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/lldb-dap" --dap-message-log=-e --binary /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/Output/unreachable_on_line.cpp.tmp -- /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp | /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp # RUN: at line 9
+ not /usr/bin/python3.8 /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/dexter.py test --fail-lt 1.0 -w -v --debugger lldb-dap --lldb-executable /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/lldb-dap --dap-message-log=-e --binary /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/projects/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/Output/unreachable_on_line.cpp.tmp -- /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp
+ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/penalty/unreachable_on_line.cpp
note: Opening DAP server: /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/bin/lldb-dap
-> {
  "type": "request",
  "command": "initialize",
  "arguments": {
    "clientID": "dexter",
    "adapterID": "lldb-dap",
    "pathFormat": "path",
    "linesStartAt1": true,
    "columnsStartAt1": true,
    "supportsVariableType": true,
    "supportsVariablePaging": true,
    "supportsRunInTerminalRequest": false
  },
  "seq": 1
}
<- {
  "body": {
    "$__lldb_version": "lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision c488dca6564d11ae84fb482599996a9d310f370d)\n  clang revision c488dca6564d11ae84fb482599996a9d310f370d\n  llvm revision c488dca6564d11ae84fb482599996a9d310f370d",
    "completionTriggerCharacters": [
      ".",
      " ",
      "\t"
    ],
    "exceptionBreakpointFilters": [
      {
        "description": "C++ Catch",
        "filter": "cpp_catch",
        "label": "C++ Catch",
        "supportsCondition": true
      },
      {
        "description": "C++ Throw",
        "filter": "cpp_throw",
        "label": "C++ Throw",
        "supportsCondition": true
      },
      {
        "description": "Objective-C Catch",
        "filter": "objc_catch",
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants