[compiletest-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing#136474
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.
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. |
| // | ||
| // 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.
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(); |
| rustc.arg("-Z").arg(format!( | ||
| "ignore-directory-in-diagnostics-source-blocks={}", | ||
| self.config.find_rust_src_root().unwrap().join("vendor").display(), | ||
| self.config.src_root.join("vendor").to_str().unwrap(), |
| "--remap-path-prefix={}={}", | ||
| self.config.src_base.display(), | ||
| self.config.src_test_suite_root.to_str().unwrap(), |
There was a problem hiding this comment.
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.
Redundant, bootstrap already passes abs path to cargo/rustdoc
|
r? bootstrap |
clubby789
left a comment
There was a problem hiding this comment.
LGTM, r=me with or without nit
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.
|
Fixed nit and rebased. |
[`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing Reference for overall changes: rust-lang#136437 Part **3** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Remove `--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. - Use `--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 an `Option<PathBuf>`. ### Review advice Best reviewed commit-by-commit. r? bootstrap
[`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing Reference for overall changes: rust-lang#136437 Part **3** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Remove `--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. - Use `--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 an `Option<PathBuf>`. ### Review advice Best reviewed commit-by-commit. r? bootstrap
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#136458 (Do not deduplicate list of associated types provided by dyn principal) - rust-lang#136474 ([`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing) - rust-lang#136592 (Make sure we don't overrun the stack in canonicalizer) - rust-lang#136787 (Remove `lifetime_capture_rules_2024` feature) - rust-lang#137180 (Give `global_asm` a fake body to store typeck results, represent `sym fn` as a hir expr to fix `sym fn` operands with lifetimes) - rust-lang#137257 (Ignore fake borrows for packed field check) - rust-lang#137348 (More sophisticated span trimming for suggestions) - rust-lang#137399 (fix ICE in layout computation with unnormalizable const) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#136458 (Do not deduplicate list of associated types provided by dyn principal) - rust-lang#136474 ([`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing) - rust-lang#136592 (Make sure we don't overrun the stack in canonicalizer) - rust-lang#136787 (Remove `lifetime_capture_rules_2024` feature) - rust-lang#137207 (Add #[track_caller] to Duration Div impl) - rust-lang#137245 (Tweak E0277 when predicate comes indirectly from ?) - rust-lang#137257 (Ignore fake borrows for packed field check) - rust-lang#137399 (fix ICE in layout computation with unnormalizable const) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136474 - jieyouxu:src-base, r=clubby789 [`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing Reference for overall changes: rust-lang#136437 Part **3** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Remove `--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. - Use `--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 an `Option<PathBuf>`. ### Review advice Best reviewed commit-by-commit. r? bootstrap
Reference for overall changes: #136437
Part 3 of 7 of the
compiletest-related cleanups PR series.Summary
--src-basecompiletest in favor of new flags--src-rootand--src-test-suite-rootwhich more accurately conveys the intent.--src-basepreviously actually meant--src-test-suite-rootand has caused multiple confusions.--src-rootto 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