Skip to content

Commit 9c40143

Browse files
---
yaml --- r: 127291 b: refs/heads/try c: e58d65c h: refs/heads/master i: 127289: c26130d 127287: a59ab78 v: v3
1 parent 5199fbc commit 9c40143

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 87d2bf400ce1bc2cec832f9d5b8e763f06bb7f43
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 12e0f72f517516ac4fce2aed85e6142e9b874bce
5-
refs/heads/try: e9c5c4c9bd3f9ed73a549c978a8cafe449587663
5+
refs/heads/try: e58d65c12c5548e314474cfd9605f94ceec0de9b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/compiletest/runtest.rs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,11 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
535535
breakpoint_lines
536536
} = parse_debugger_commands(testfile, "lldb");
537537

538+
let rust_src_root = match find_rust_src_root(config) {
539+
Some(path) => path,
540+
None => fatal("Could not find Rust source root directory")
541+
};
542+
538543
// Write debugger script:
539544
// We don't want to hang when calling `quit` while the process is still running
540545
let mut script_str = String::from_str("settings set auto-confirm true\n");
@@ -543,7 +548,13 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
543548
script_str.push_str("version\n");
544549

545550
// Switch LLDB into "Rust mode"
546-
script_str.push_str("command script import ./src/etc/lldb_rust_formatters.py\n");
551+
let rust_formatters_postfix = Path::new("./src/etc/lldb_rust_formatters.py");
552+
let lldb_rust_formatters = rust_src_root.join(rust_formatters_postfix);
553+
554+
script_str.push_str("command script import ");
555+
script_str.push_str(lldb_rust_formatters.as_str()
556+
.expect("Could not convert lldb_rust_formatters path to UTF-8"));
557+
script_str.push_str("\n");
547558
script_str.push_str("type summary add --no-value ");
548559
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
549560
script_str.push_str("-x \".*\" --category Rust\n");
@@ -573,18 +584,28 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
573584
let debugger_script = make_out_name(config, testfile, "debugger.script");
574585

575586
// Let LLDB execute the script via lldb_batchmode.py
576-
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
587+
let lldb_batchmode_path = rust_src_root
588+
.join(Path::new("./src/etc/lldb_batchmode.py"));
589+
590+
let debugger_run_result = run_lldb(config,
591+
&lldb_batchmode_path,
592+
&exe_file,
593+
&debugger_script);
577594

578595
if !debugger_run_result.status.success() {
579596
fatal_proc_rec("Error while running LLDB", &debugger_run_result);
580597
}
581598

582599
check_debugger_output(&debugger_run_result, check_lines.as_slice());
583600

584-
fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
601+
fn run_lldb(config: &Config,
602+
lldb_batchmode: &Path,
603+
test_executable: &Path,
604+
debugger_script: &Path)
605+
-> ProcRes {
585606
// Prepare the lldb_batchmode which executes the debugger script
586607
let mut cmd = Command::new("python");
587-
cmd.arg("./src/etc/lldb_batchmode.py")
608+
cmd.arg(lldb_batchmode)
588609
.arg(test_executable)
589610
.arg(debugger_script)
590611
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
@@ -612,6 +633,19 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
612633
cmdline: format!("{}", cmd)
613634
};
614635
}
636+
637+
fn find_rust_src_root(config: &Config) -> Option<Path> {
638+
let mut path = config.src_base.clone();
639+
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
640+
641+
while path.pop() {
642+
if path.join(path_postfix.clone()).is_file() {
643+
return Some(path);
644+
}
645+
}
646+
647+
return None;
648+
}
615649
}
616650

617651
struct DebuggerCommands {

0 commit comments

Comments
 (0)