Skip to content

Commit 9e6b565

Browse files
committed
Rollup merge of rust-lang#45051 - k0pernicus:master, r=michaelwoerister
Debugger pretty printer files are take into account in test execution time-stamping This PR is proposed to solve the issue rust-lang#45022.
2 parents dad731c + 53a6485 commit 9e6b565

File tree

3 files changed

+47
-29
lines changed

3 files changed

+47
-29
lines changed

src/tools/compiletest/src/header.rs

+13
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,19 @@ impl Config {
567567
None
568568
}
569569
}
570+
571+
pub fn find_rust_src_root(&self) -> Option<PathBuf> {
572+
let mut path = self.src_base.clone();
573+
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
574+
575+
while path.pop() {
576+
if path.join(&path_postfix).is_file() {
577+
return Some(path);
578+
}
579+
}
580+
581+
None
582+
}
570583
}
571584

572585
pub fn lldb_version_to_int(version_string: &str) -> isize {

src/tools/compiletest/src/main.rs

+20-7
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,28 @@ fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
489489
}
490490

491491
fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool {
492+
let rust_src_dir = config.find_rust_src_root().expect(
493+
"Could not find Rust source root",
494+
);
492495
let stamp = mtime(&stamp(config, testpaths));
493-
let mut inputs = vec![
494-
mtime(&testpaths.file),
495-
mtime(&config.rustc_path),
496-
];
496+
let mut inputs = vec![mtime(&testpaths.file), mtime(&config.rustc_path)];
497497
for aux in props.aux.iter() {
498-
inputs.push(mtime(&testpaths.file.parent().unwrap()
499-
.join("auxiliary")
500-
.join(aux)));
498+
inputs.push(mtime(
499+
&testpaths.file.parent().unwrap().join("auxiliary").join(
500+
aux,
501+
),
502+
));
503+
}
504+
// Relevant pretty printer files
505+
let pretty_printer_files = [
506+
"src/etc/debugger_pretty_printers_common.py",
507+
"src/etc/gdb_load_rust_pretty_printers.py",
508+
"src/etc/gdb_rust_pretty_printing.py",
509+
"src/etc/lldb_batchmode.py",
510+
"src/etc/lldb_rust_formatters.py",
511+
];
512+
for pretty_printer_file in &pretty_printer_files {
513+
inputs.push(mtime(&rust_src_dir.join(pretty_printer_file)));
501514
}
502515
for lib in config.run_lib_path.read_dir().unwrap() {
503516
let lib = lib.unwrap();

src/tools/compiletest/src/runtest.rs

+14-22
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,10 @@ actual:\n\
571571
}
572572
}
573573

574-
_=> {
575-
let rust_src_root = self.find_rust_src_root()
576-
.expect("Could not find Rust source root");
574+
_ => {
575+
let rust_src_root = self.config.find_rust_src_root().expect(
576+
"Could not find Rust source root",
577+
);
577578
let rust_pp_module_rel_path = Path::new("./src/etc");
578579
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
579580
.to_str()
@@ -664,19 +665,6 @@ actual:\n\
664665
self.check_debugger_output(&debugger_run_result, &check_lines);
665666
}
666667

667-
fn find_rust_src_root(&self) -> Option<PathBuf> {
668-
let mut path = self.config.src_base.clone();
669-
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
670-
671-
while path.pop() {
672-
if path.join(&path_postfix).is_file() {
673-
return Some(path);
674-
}
675-
}
676-
677-
None
678-
}
679-
680668
fn run_debuginfo_lldb_test(&self) {
681669
assert!(self.revision.is_none(), "revisions not relevant here");
682670

@@ -735,7 +723,9 @@ actual:\n\
735723
script_str.push_str("version\n");
736724

737725
// Switch LLDB into "Rust mode"
738-
let rust_src_root = self.find_rust_src_root().expect("Could not find Rust source root");
726+
let rust_src_root = self.config.find_rust_src_root().expect(
727+
"Could not find Rust source root",
728+
);
739729
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
740730
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
741731
.to_str()
@@ -1717,11 +1707,13 @@ actual:\n\
17171707
if self.props.check_test_line_numbers_match {
17181708
self.check_rustdoc_test_option(proc_res);
17191709
} else {
1720-
let root = self.find_rust_src_root().unwrap();
1721-
let res = self.cmd2procres(Command::new(&self.config.docck_python)
1722-
.arg(root.join("src/etc/htmldocck.py"))
1723-
.arg(out_dir)
1724-
.arg(&self.testpaths.file));
1710+
let root = self.config.find_rust_src_root().unwrap();
1711+
let res = self.cmd2procres(
1712+
Command::new(&self.config.docck_python)
1713+
.arg(root.join("src/etc/htmldocck.py"))
1714+
.arg(out_dir)
1715+
.arg(&self.testpaths.file),
1716+
);
17251717
if !res.status.success() {
17261718
self.fatal_proc_rec("htmldocck failed!", &res);
17271719
}

0 commit comments

Comments
 (0)