[llvm] [cross-project-tests] Add `has-gdb` LIT feature (PR #188780)

Michael Buch via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 09:00:19 PDT 2026


https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/188780

This patch adds a `has-gdb` LIT feature that I then use in the `REQUIRES` clause for `llgdb` tests.

These tests were failing because `llgdb.py` couldn't find `gdb` on the host when I tried enabling these tests on PR CI (https://github.com/llvm/llvm-project/issues/188775).

We should get `gdb` installed on the buildbots. But we should also be able to run the rest of the `cross-project-tests` in the meantime even if gdb isn't installed.

>From 364c5e6364430aab06a1c7a76087ad3df3dfc53b Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 26 Mar 2026 14:27:45 +0000
Subject: [PATCH] [cross-project-tests] Add `has-gdb` LIT feature

This patch adds a `has-gdb` LIT feature that I then use in the `REQUIRES` clause for `llgdb` tests.

These tests were failing because `llgdb.py` couldn't find `gdb` on the host when I tried enabling these tests on PR CI (https://github.com/llvm/llvm-project/issues/188775).

We should get `gdb` installed on the buildbots. But we should also be able to run the rest of the `cross-project-tests` in the meantime even if gdb isn't installed.
---
 .../dexter-tests/memvars/const-branch.c             |  2 +-
 .../commands/perfect/expect_step_kind/direction.cpp |  3 +++
 .../llgdb-tests/forward-declare-class.cpp           |  1 +
 .../debuginfo-tests/llgdb-tests/nested-struct.cpp   |  2 ++
 .../debuginfo-tests/llgdb-tests/nrvo-string.cpp     |  2 ++
 .../debuginfo-tests/llgdb-tests/sret.cpp            |  2 ++
 .../debuginfo-tests/llgdb-tests/static-member-2.cpp |  2 ++
 .../debuginfo-tests/llgdb-tests/static-member.cpp   |  2 ++
 cross-project-tests/lit.cfg.py                      | 13 +++++++++++++
 9 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c b/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c
index c67dd0a3747b2..a0541822915bd 100644
--- a/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c
+++ b/cross-project-tests/debuginfo-tests/dexter-tests/memvars/const-branch.c
@@ -1,4 +1,4 @@
-// XFAIL: !system-darwin || !target-aarch64
+// XFAIL: !system-darwin
 //// Suboptimal coverage, see inlined comments.
 
 // REQUIRES: lldb
diff --git a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp
index c155cfcad5c3c..47938a30c9691 100644
--- a/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp
+++ b/cross-project-tests/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp
@@ -10,6 +10,9 @@
 // TODO: The dbgeng debugger does not support column step reporting at present.
 // XFAIL: system-windows
 //
+// TODO: fails in on Linux CI (https://github.com/llvm/llvm-project/issues/188775)
+// XFAIL: system-linux
+//
 // RUN: %dexter_regression_test_cxx_build %s -o %t
 // RUN: %dexter_regression_test_run --binary %t -- %s | FileCheck %s
 // CHECK: direction.cpp:
diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/forward-declare-class.cpp b/cross-project-tests/debuginfo-tests/llgdb-tests/forward-declare-class.cpp
index 130c439faec8c..1ce361b21f092 100644
--- a/cross-project-tests/debuginfo-tests/llgdb-tests/forward-declare-class.cpp
+++ b/cross-project-tests/debuginfo-tests/llgdb-tests/forward-declare-class.cpp
@@ -1,6 +1,7 @@
 // RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
 // RUN: %test_debuginfo %s %t.o
 // Radar 9168773
+// REQUIRES: system-darwin || has-gdb
 // XFAIL: !system-darwin && gdb-clang-incompatibility
 
 // DEBUGGER: ptype A
diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/nested-struct.cpp b/cross-project-tests/debuginfo-tests/llgdb-tests/nested-struct.cpp
index 08668d61d222c..01b7cf8d8c798 100644
--- a/cross-project-tests/debuginfo-tests/llgdb-tests/nested-struct.cpp
+++ b/cross-project-tests/debuginfo-tests/llgdb-tests/nested-struct.cpp
@@ -1,3 +1,5 @@
+// REQUIRES: system-darwin || has-gdb
+//
 // RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
 // RUN: %test_debuginfo %s %t.o
 // XFAIL: !system-darwin && gdb-clang-incompatibility
diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/nrvo-string.cpp b/cross-project-tests/debuginfo-tests/llgdb-tests/nrvo-string.cpp
index 988c4ae2232ae..4139a1d99d6d3 100644
--- a/cross-project-tests/debuginfo-tests/llgdb-tests/nrvo-string.cpp
+++ b/cross-project-tests/debuginfo-tests/llgdb-tests/nrvo-string.cpp
@@ -1,3 +1,5 @@
+// REQUIRES: system-darwin || has-gdb
+//
 // This ensures that DW_OP_deref is inserted when necessary, such as when NRVO
 // of a string object occurs in C++.
 //
diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp b/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp
index 28f057b4e9b56..e0fd0072b31f7 100644
--- a/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp
+++ b/cross-project-tests/debuginfo-tests/llgdb-tests/sret.cpp
@@ -1,3 +1,5 @@
+// REQUIRES: system-darwin || has-gdb
+//
 // RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
 // RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
 // RUN: %test_debuginfo %s %t.out
diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/static-member-2.cpp b/cross-project-tests/debuginfo-tests/llgdb-tests/static-member-2.cpp
index c9b416dace925..2fe1c79cbeaa6 100644
--- a/cross-project-tests/debuginfo-tests/llgdb-tests/static-member-2.cpp
+++ b/cross-project-tests/debuginfo-tests/llgdb-tests/static-member-2.cpp
@@ -1,3 +1,5 @@
+// REQUIRES: system-darwin || has-gdb
+//
 // RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c
 // RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out
 // RUN: %test_debuginfo %s %t.out
diff --git a/cross-project-tests/debuginfo-tests/llgdb-tests/static-member.cpp b/cross-project-tests/debuginfo-tests/llgdb-tests/static-member.cpp
index 492e0ca084209..d04868e14581d 100644
--- a/cross-project-tests/debuginfo-tests/llgdb-tests/static-member.cpp
+++ b/cross-project-tests/debuginfo-tests/llgdb-tests/static-member.cpp
@@ -1,3 +1,5 @@
+// REQUIRES: system-darwin || has-gdb
+//
 // RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -o %t -c
 // RUN: %clangxx %target_itanium_abi_host_triple %t -o %t.out
 // RUN: %test_debuginfo %s %t.out
diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py
index 158f172408b16..845965beec218 100644
--- a/cross-project-tests/lit.cfg.py
+++ b/cross-project-tests/lit.cfg.py
@@ -357,6 +357,19 @@ def set_apple_lldb_pre_1000_feature():
 # platform and the installed gdb version.
 dwarf_version_string = get_clang_default_dwarf_version_string(config.host_triple)
 gdb_version_string = get_gdb_version_string()
+
+if gdb_version_string:
+    config.available_features.add("has-gdb")
+    print(
+        f"Found GDB version '{gdb_version_string}'",
+        file=sys.stderr,
+    )
+else:
+    print(
+        "No GDB found on host. Skipping tests that require GDB.",
+        file=sys.stderr,
+    )
+
 if dwarf_version_string and gdb_version_string:
     if int(dwarf_version_string) >= 5:
         try:



More information about the llvm-commits mailing list