Skip to content

Debugger pretty printer files are take into account in test execution time-stamping #45051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,19 @@ impl Config {
None
}
}

pub fn find_rust_src_root(&self) -> Option<PathBuf> {
let mut path = self.src_base.clone();
let path_postfix = Path::new("src/etc/lldb_batchmode.py");

while path.pop() {
if path.join(&path_postfix).is_file() {
return Some(path);
}
}

None
}
}

pub fn lldb_version_to_int(version_string: &str) -> isize {
Expand Down
27 changes: 20 additions & 7 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,28 @@ fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
}

fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool {
let rust_src_dir = config.find_rust_src_root().expect(
"Could not find Rust source root",
);
let stamp = mtime(&stamp(config, testpaths));
let mut inputs = vec![
mtime(&testpaths.file),
mtime(&config.rustc_path),
];
let mut inputs = vec![mtime(&testpaths.file), mtime(&config.rustc_path)];
for aux in props.aux.iter() {
inputs.push(mtime(&testpaths.file.parent().unwrap()
.join("auxiliary")
.join(aux)));
inputs.push(mtime(
&testpaths.file.parent().unwrap().join("auxiliary").join(
aux,
),
));
}
// Relevant pretty printer files
let pretty_printer_files = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this part, I don't know if the more relevant way to do is to "crawl" the rust_src_path, and to check if file which contains in the name "pretty_print". Using this solution, if a member creates a new pretty printer file, this file will be automatically checked in up_to_date...
The cons of this automated solution is that we must respect title rules for the pretty printing files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit list is fine for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But could you please add lldb_batchmode.py and lldb_rust_formatters.py as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem!

"src/etc/debugger_pretty_printers_common.py",
"src/etc/gdb_load_rust_pretty_printers.py",
"src/etc/gdb_rust_pretty_printing.py",
"src/etc/lldb_batchmode.py",
"src/etc/lldb_rust_formatters.py",
];
for pretty_printer_file in &pretty_printer_files {
inputs.push(mtime(&rust_src_dir.join(pretty_printer_file)));
}
for lib in config.run_lib_path.read_dir().unwrap() {
let lib = lib.unwrap();
Expand Down
36 changes: 14 additions & 22 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,10 @@ actual:\n\
}
}

_=> {
let rust_src_root = self.find_rust_src_root()
.expect("Could not find Rust source root");
_ => {
let rust_src_root = self.config.find_rust_src_root().expect(
"Could not find Rust source root",
);
let rust_pp_module_rel_path = Path::new("./src/etc");
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
.to_str()
Expand Down Expand Up @@ -664,19 +665,6 @@ actual:\n\
self.check_debugger_output(&debugger_run_result, &check_lines);
}

fn find_rust_src_root(&self) -> Option<PathBuf> {
let mut path = self.config.src_base.clone();
let path_postfix = Path::new("src/etc/lldb_batchmode.py");

while path.pop() {
if path.join(&path_postfix).is_file() {
return Some(path);
}
}

None
}

fn run_debuginfo_lldb_test(&self) {
assert!(self.revision.is_none(), "revisions not relevant here");

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

// Switch LLDB into "Rust mode"
let rust_src_root = self.find_rust_src_root().expect("Could not find Rust source root");
let rust_src_root = self.config.find_rust_src_root().expect(
"Could not find Rust source root",
);
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
.to_str()
Expand Down Expand Up @@ -1717,11 +1707,13 @@ actual:\n\
if self.props.check_test_line_numbers_match {
self.check_rustdoc_test_option(proc_res);
} else {
let root = self.find_rust_src_root().unwrap();
let res = self.cmd2procres(Command::new(&self.config.docck_python)
.arg(root.join("src/etc/htmldocck.py"))
.arg(out_dir)
.arg(&self.testpaths.file));
let root = self.config.find_rust_src_root().unwrap();
let res = self.cmd2procres(
Command::new(&self.config.docck_python)
.arg(root.join("src/etc/htmldocck.py"))
.arg(out_dir)
.arg(&self.testpaths.file),
);
if !res.status.success() {
self.fatal_proc_rec("htmldocck failed!", &res);
}
Expand Down