Skip to content

Commit 07c2b44

Browse files
committed
[debuginfo-tests] Use built lldb if available
The cross-project-tests's debuginfo-tests don't rely on lldb being built to run. While this is a good, a bug in the system lldb can cause a test to fail with no way of fixing it. This patch makes it so the tests use the built lldb instead if it's available.
1 parent e6382f2 commit 07c2b44

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

cross-project-tests/debuginfo-tests/llgdb-tests/llgdb.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
# Auto-detect lldb python module.
99
import subprocess, platform, os, sys
1010

11+
# Set the path to look first for the built lldb (in case it exists).
12+
llvm_libs_dir = os.environ["LLVM_LIBS_DIR"]
13+
built_lldb_path = os.path.join(
14+
llvm_libs_dir,
15+
f"python{sys.version_info.major}.{sys.version_info.minor}",
16+
"site-packages",
17+
)
18+
sys.path.insert(0, built_lldb_path)
1119
try:
1220
# Just try for LLDB in case PYTHONPATH is already correctly setup.
1321
import lldb

cross-project-tests/debuginfo-tests/llgdb-tests/test_debuginfo.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
if (!$my_debugger) {
5757
if ($use_lldb) {
5858
my $path = dirname(Cwd::abs_path($0));
59-
$my_debugger = "/usr/bin/xcrun python3 $path/llgdb.py";
59+
$my_debugger = "LLVM_LIBS_DIR=$ENV{'LLVM_LIBS_DIR'} /usr/bin/xcrun python3 $path/llgdb.py";
6060
} else {
6161
$my_debugger = "gdb";
6262
}

cross-project-tests/lit.cfg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
tools = [
3838
ToolSubst(
3939
"%test_debuginfo",
40-
command=os.path.join(
40+
command=
41+
"LLVM_LIBS_DIR=" + config.llvm_libs_dir + " " +
42+
os.path.join(
4143
config.cross_project_tests_src_root,
4244
"debuginfo-tests",
4345
"llgdb-tests",

0 commit comments

Comments
 (0)