-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[compiletest
-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing
#136474
base: master
Are you sure you want to change the base?
Conversation
compiletest
-related cleanups3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusingcompiletest
-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing
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 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was semi-necessary back in #16322 (Aug 2014, 11 years ago) because bootstrap didn't exist and compiletest was invoked directly, but now we have bootstrap so this isn't needed anymore.
☔ The latest upstream changes (presumably #136809) made this pull request unmergeable. Please resolve the merge conflicts. |
Prerequisite PRs have merged so this is now unblocked. |
Instead of only having `--src-base` and `src_base` which *actually* refers to the directory containing the test suite and not the sources root. More importantly, kill off `find_rust_src_root` when we can simply pass that info from bootstrap.
// | ||
// FIXME(jieyouxu): untangle these paths, we should provide both a path to root `tests/` or | ||
// `tests/auxiliary/` and the test suite in question. `src_base` is also a terrible name. | ||
related.push(config.src_base.parent().unwrap().join("auxiliary").join("minicore.rs")); | ||
related.push(config.src_root.join("tests").join("auxiliary").join("minicore.rs")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also helps to cleanup this
// Print the name of the file, relative to the repository root. | ||
// `src_base` looks like `/path/to/rust/tests/ui` | ||
let root_directory = config.src_base.parent().unwrap().parent().unwrap(); | ||
let path = testpaths.file.strip_prefix(root_directory).unwrap(); | ||
// Print the name of the file, relative to the sources root. | ||
let path = testpaths.file.strip_prefix(&config.src_root).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this
self.config.find_rust_src_root().unwrap().join("vendor").display(), | ||
self.config.src_root.join("vendor").to_str().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And these
"--remap-path-prefix={}={}", | ||
self.config.src_base.display(), | ||
self.config.src_test_suite_root.to_str().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was very confusing to me, because this is not the source root, but actually the root of the test suite sources
cmd.env("CARGO", source_root.join(cargo)); | ||
cmd.env("CARGO", cargo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant, bootstrap already passes abs path to cargo/rustdoc
Reference for overall changes: #136437
Part 3 of 7 of the
compiletest
-related cleanups PR series.Summary
--src-base
compiletest in favor of new flags--src-root
and--src-test-suite-root
which more accurately conveys the intent.--src-base
previously actually meant--src-test-suite-root
and has caused multiple confusions.--src-root
to have bootstrap directly feed source root path to compiletest, instead of doing a hacky directory parent search heuristic (find_rust_src_root
) that somehow returns anOption<PathBuf>
.Review advice
Best reviewed commit-by-commit.
r? bootstrap