Skip to content

Commit dbf0167

Browse files
debuginfo: Make some path LLDB-related paths in the test runner absolute to help the build bots.
1 parent 47e8cf7 commit dbf0167

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/compiletest/runtest.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,15 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
653653
script_str.push_str("version\n");
654654

655655
// Switch LLDB into "Rust mode"
656-
script_str.push_str("command script import ./src/etc/lldb_rust_formatters.py\n");
656+
let rust_src_root = find_rust_src_root(config)
657+
.expect("Could not find Rust source root");
658+
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
659+
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
660+
.as_str()
661+
.unwrap()
662+
.to_string();
663+
664+
script_str.push_str(format!("command script import {}\n", rust_pp_module_abs_path[])[]);
657665
script_str.push_str("type summary add --no-value ");
658666
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
659667
script_str.push_str("-x \".*\" --category Rust\n");
@@ -683,18 +691,27 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
683691
let debugger_script = make_out_name(config, testfile, "debugger.script");
684692

685693
// Let LLDB execute the script via lldb_batchmode.py
686-
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
694+
let debugger_run_result = run_lldb(config,
695+
&exe_file,
696+
&debugger_script,
697+
&rust_src_root);
687698

688699
if !debugger_run_result.status.success() {
689700
fatal_proc_rec("Error while running LLDB", &debugger_run_result);
690701
}
691702

692703
check_debugger_output(&debugger_run_result, check_lines.as_slice());
693704

694-
fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
705+
fn run_lldb(config: &Config,
706+
test_executable: &Path,
707+
debugger_script: &Path,
708+
rust_src_root: &Path)
709+
-> ProcRes {
695710
// Prepare the lldb_batchmode which executes the debugger script
711+
let lldb_script_path = rust_src_root.join(Path::new("./src/etc/lldb_batchmode.py"));
712+
696713
let mut cmd = Command::new("python");
697-
cmd.arg("./src/etc/lldb_batchmode.py")
714+
cmd.arg(lldb_script_path)
698715
.arg(test_executable)
699716
.arg(debugger_script)
700717
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);

0 commit comments

Comments
 (0)