Skip to content

Commit b27aee9

Browse files
committed
stabilize ci_rustc_if_unchanged_logic test
Signed-off-by: onur-ozkan <[email protected]>
1 parent df1b5d3 commit b27aee9

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

Diff for: src/bootstrap/src/core/builder/tests.rs

+11-28
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use std::thread;
22

3-
use build_helper::git::get_closest_merge_commit;
4-
53
use super::*;
64
use crate::Flags;
75
use crate::core::build_steps::doc::DocumentationFormat;
@@ -214,8 +212,6 @@ fn alias_and_path_for_library() {
214212
assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]);
215213
}
216214

217-
// FIXME: This is failing in various runners in merge CI.
218-
#[ignore]
219215
#[test]
220216
fn ci_rustc_if_unchanged_logic() {
221217
let config = Config::parse_inner(
@@ -227,10 +223,6 @@ fn ci_rustc_if_unchanged_logic() {
227223
|&_| Ok(Default::default()),
228224
);
229225

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

@@ -240,26 +232,17 @@ fn ci_rustc_if_unchanged_logic() {
240232

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

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());
235+
// Make sure "if-unchanged" logic doesn't try to use CI rustc while there are changes
236+
// in compiler and/or library.
237+
if config.download_rustc_commit.is_some() {
238+
let has_changes =
239+
config.last_modified_commit(&["compiler", "library"], "download-rustc", true).is_none();
240+
241+
assert!(
242+
!has_changes,
243+
"CI-rustc can't be used with 'if-unchanged' while there are changes in compiler and/or library."
244+
);
245+
}
263246
}
264247

265248
mod defaults {

0 commit comments

Comments
 (0)