[debuginfo-tests] Use built lldb for testing if available (#131681)
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.
diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py
index 66fdd63..ccd3d01 100644
--- a/cross-project-tests/lit.cfg.py
+++ b/cross-project-tests/lit.cfg.py
@@ -34,10 +34,21 @@
llvm_config.use_default_substitutions()
+lldb_python_path = os.path.join(
+ config.llvm_libs_dir,
+ f"python{sys.version_info.major}.{sys.version_info.minor}",
+ "site-packages",
+)
+python_exec_path = sys.executable
tools = [
ToolSubst(
"%test_debuginfo",
- command=os.path.join(
+ command="PYTHON_EXEC_PATH="
+ + python_exec_path
+ + " LLDB_PYTHON_PATH="
+ + lldb_python_path
+ + " "
+ + os.path.join(
config.cross_project_tests_src_root,
"debuginfo-tests",
"llgdb-tests",