-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[DO NOT LOOK] a bunch of compiletest-related changes #136437
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, forgor to write ghost. |
let root = self.config.find_rust_src_root().unwrap(); | ||
let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap()); | ||
json_out.set_extension("json"); | ||
let res = self.run_command_to_procres( | ||
Command::new(self.config.jsondocck_path.as_ref().unwrap()) | ||
.arg("--doc-dir") | ||
.arg(root.join(&out_dir)) | ||
.arg(&out_dir) |
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 simply wrong, and only happens to work because PathBuf::join
when the arg is an absolute path out_dir
will simply became a replacement operation.
// [local-self] no-remap-src-base: The hack should work regardless of remapping. | ||
// The hack should work regardless of remapping. |
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 is kinda-wrong, in the sense that no-remap-src-base
is not a directive yet this line looks like a revisioned directive, but also, because this isn't recognized as a revisioned compiletest directive (not //@
), it ends up functioning as intended.
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().unwrap().to_owned(); |
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.
Beautiful incantation :ferrisClueless:
// FIXME(jieyouxu): improve the communication between bootstrap and compiletest here so | ||
// we don't have to hack out a `stageN`. | ||
let stage = self.config.stage_id.split('-').next().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.
Yeah, for example, by actually passing the stage number through a flag like --stage
// Path to `$build_dir/$host_triple/`. | ||
.env("BUILD_ROOT", &host_build_root) |
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.
Cheeky, not build/
, but build/$host/
.
cmd.env("CARGO", source_root.join(cargo)); | ||
cmd.env("CARGO", cargo); | ||
} | ||
|
||
if let Some(ref rustdoc) = self.config.rustdoc_path { | ||
cmd.env("RUSTDOC", source_root.join(rustdoc)); | ||
cmd.env("RUSTDOC", rustdoc); |
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.
self.config.src_base.ends_with("rustdoc-ui") | ||
|| self.config.src_base.ends_with("rustdoc-js") | ||
|| self.config.src_base.ends_with("rustdoc-json") | ||
matches!(self.config.suite.as_str(), "rustdoc-ui" | "rustdoc-js" | "rustdoc-json") |
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.
Not sure what's happening here lol
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.
No need to use a heuristic to find source root, when we can just provide it through bootstrap.
/// The directory containing the tests to run | ||
pub src_base: PathBuf, | ||
|
||
/// The directory where programs should be built | ||
pub build_base: PathBuf, | ||
|
||
/// The directory containing the compiler sysroot | ||
pub sysroot_base: PathBuf, | ||
|
||
/// Path to directory containing rust-lang/rust sources. | ||
pub src_root: PathBuf, | ||
/// Path to the directory containg the test suite sources. Expected to be a subdirectory of | ||
/// `src_root`. | ||
pub src_test_suite_root: PathBuf, | ||
|
||
/// Bootstrap build directory. | ||
pub build_root: PathBuf, | ||
/// Bootstrap test suite build directory. Expected to be a subdirectory of `build_root`. | ||
pub build_test_suite_root: PathBuf, |
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.
These are terribly named, and looking at the runtest impls, it has confused multiple people. src_base
is not sources root, it's the directory $SRC_ROOT/tests/<test-suite>/
. build_base
is not build directory root, it's $BUILD/<host-triple>/test/<test-suite>
.
// eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui | ||
normalize_path(test_build_dir, "$TEST_BUILD_DIR"); | ||
normalize_path(&self.config.build_test_suite_root, "$TEST_BUILD_DIR"); | ||
eprintln!("build_test_suite_root = {:?}", self.config.build_test_suite_root.display()); |
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.
Reminder: delete this
…piler-errors [`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic Reference for overall changes: rust-lang#136437 Part **1** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Don't match on path when we already have test suite names. - Remove a useless path join. r? bootstrap (or compiler)
Rollup merge of rust-lang#136441 - jieyouxu:cleanup-is-rustdoc, r=compiler-errors [`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic Reference for overall changes: rust-lang#136437 Part **1** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Don't match on path when we already have test suite names. - Remove a useless path join. r? bootstrap (or compiler)
[`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic Reference for overall changes: rust-lang/rust#136437 Part **1** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Don't match on path when we already have test suite names. - Remove a useless path join. r? bootstrap (or compiler)
Some exploratory changes while trying to figure out why cg_clif's tests were failing.
Not intended for review, this PR needs to be broken up into reviewable PRs with logical commits. Only posted for reference purposes.
Planned PR series
is_rustdoc
matching logic and remove a uselessrustdoc-json
Path::join
. [compiletest
-related cleanups 1/7] Cleanupis_rustdoc
logic and remove a useless path join in rustdoc-json runtest logic #136441--stage
as a compiletest flag to not have to dostage-id
gymnastics in run-make runtest logic. [compiletest
-related cleanups 2/7] Feed stage number to compiletest directly #136472src_base
handling: split--src-base
into two flags,--src-root
and--src-test-suite-root
, and tidy up logic that exercisessrc_base
previously. Removefind_rust_src_root
. [compiletest
-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing #136474build_base
handling: split--build-base
into two flags,--build-root
and--build-test-suite-root
, and tidy up logic that exercisesbuild_base
previously. [compiletest
-related cleanups 4/7] Make the distinction between root build directory vs test suite specific build directory in compiletest less confusing #136542{{src-base}}
->{{test-suite-src-base}}
. Rebless tests. Update rustc-dev-guide.{{rust-src-base}}
->{{sysroot-rust-src-base}}
. Rebless tests. Update rustc-dev-guide.{{build-base}}
->{{test-suite-build-base}}
. Rebless tests. Update rustc-dev-guide.