Skip to content

Commit

Permalink
stabilize ci_rustc_if_unchanged_logic test
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Oct 9, 2024
1 parent 4203c68 commit 28620e9
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ fn ci_rustc_if_unchanged_logic() {
|&_| Ok(Default::default()),
);

if config.rust_info.is_from_tarball() {
return;
}

let build = Build::new(config.clone());
let builder = Builder::new(&build);

Expand All @@ -238,26 +234,30 @@ fn ci_rustc_if_unchanged_logic() {

builder.run_step_descriptions(&Builder::get_step_descriptions(config.cmd.kind()), &[]);

let compiler_path = build.src.join("compiler");
let library_path = build.src.join("library");

let commit =
get_closest_merge_commit(Some(&builder.config.src), &builder.config.git_config(), &[
compiler_path.clone(),
library_path.clone(),
])
.unwrap();

let has_changes = !helpers::git(Some(&builder.src))
.args(["diff-index", "--quiet", &commit])
.arg("--")
.args([compiler_path, library_path])
.as_command_mut()
.status()
.unwrap()
.success();

assert!(has_changes == config.download_rustc_commit.is_none());
// Make sure "if-unchanged" logic doesn't try to use CI rustc while there are changes
// in compiler and/or library.
if config.download_rustc_commit.is_some() {
let compiler_path = build.src.join("compiler");
let library_path = build.src.join("library");

let commit =
get_closest_merge_commit(Some(&builder.config.src), &builder.config.git_config(), &[
compiler_path.clone(),
library_path.clone(),
])
.unwrap();

let has_changes = !helpers::git(Some(&builder.src))
.args(["diff-index", "--quiet", &commit])
.arg("--")
.args([compiler_path, library_path])
.as_command_mut()
.status()
.unwrap()
.success();

assert!(!has_changes);
}
}

mod defaults {
Expand Down

0 comments on commit 28620e9

Please sign in to comment.