Skip to content

Commit 469b35a

Browse files
committed
stabilize ci_rustc_if_unchanged_logic test
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent df1b5d3 commit 469b35a

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

src/bootstrap/src/core/builder/tests.rs

+27-26
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ fn alias_and_path_for_library() {
214214
assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]);
215215
}
216216

217-
// FIXME: This is failing in various runners in merge CI.
218-
#[ignore]
219217
#[test]
220218
fn ci_rustc_if_unchanged_logic() {
221219
let config = Config::parse_inner(
@@ -227,10 +225,6 @@ fn ci_rustc_if_unchanged_logic() {
227225
|&_| Ok(Default::default()),
228226
);
229227

230-
if config.rust_info.is_from_tarball() {
231-
return;
232-
}
233-
234228
let build = Build::new(config.clone());
235229
let builder = Builder::new(&build);
236230

@@ -240,26 +234,33 @@ fn ci_rustc_if_unchanged_logic() {
240234

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

243-
let compiler_path = build.src.join("compiler");
244-
let library_path = build.src.join("library");
245-
246-
let commit =
247-
get_closest_merge_commit(Some(&builder.config.src), &builder.config.git_config(), &[
248-
compiler_path.clone(),
249-
library_path.clone(),
250-
])
251-
.unwrap();
252-
253-
let has_changes = !helpers::git(Some(&builder.src))
254-
.args(["diff-index", "--quiet", &commit])
255-
.arg("--")
256-
.args([compiler_path, library_path])
257-
.as_command_mut()
258-
.status()
259-
.unwrap()
260-
.success();
261-
262-
assert!(has_changes == config.download_rustc_commit.is_none());
237+
// Make sure "if-unchanged" logic doesn't try to use CI rustc while there are changes
238+
// in compiler and/or library.
239+
if config.download_rustc_commit.is_some() {
240+
let compiler_path = build.src.join("compiler");
241+
let library_path = build.src.join("library");
242+
243+
let commit =
244+
get_closest_merge_commit(Some(&builder.config.src), &builder.config.git_config(), &[
245+
compiler_path.clone(),
246+
library_path.clone(),
247+
])
248+
.unwrap();
249+
250+
let has_changes = !helpers::git(Some(&builder.src))
251+
.args(["diff-index", "--quiet", &commit])
252+
.arg("--")
253+
.args([compiler_path, library_path])
254+
.as_command_mut()
255+
.status()
256+
.unwrap()
257+
.success();
258+
259+
assert!(
260+
!has_changes,
261+
"CI download can't be enabled from 'if-unchanged' while there are changes in compiler and/or library."
262+
);
263+
}
263264
}
264265

265266
mod defaults {

0 commit comments

Comments
 (0)