Auto merge of #131444 - onur-ozkan:hotfix-ci, r=Kobzol

stabilize `ci_rustc_if_unchanged_logic` test

Makes `ci_rustc_if_unchanged_logic` test more stable and re-enables it. Previously, it was expecting CI-rustc to be used all the time when there were no changes, which wasn’t always the case. Purpose of this test is making sure we don't use CI-rustc while there are changes in compiler and/or library, but we don't really need to cover cases where CI-rustc is not enabled.

Second commit was pushed for making a change in the compiler tree, so `ci_rustc_if_unchanged_logic` can be tested properly in merge CI.
This commit is contained in:
bors 2024-10-10 23:51:17 +00:00
commit 249df9e791
2 changed files with 11 additions and 28 deletions

View File

@ -3,7 +3,7 @@
//! we can prove overlap one way or another. Essentially, we treat `Overlap` as //! we can prove overlap one way or another. Essentially, we treat `Overlap` as
//! a monoid and report a conflict if the product ends up not being `Disjoint`. //! a monoid and report a conflict if the product ends up not being `Disjoint`.
//! //!
//! At each step, if we didn't run out of borrow or place, we know that our elements //! On each step, if we didn't run out of borrow or place, we know that our elements
//! have the same type, and that they only overlap if they are the identical. //! have the same type, and that they only overlap if they are the identical.
//! //!
//! For example, if we are comparing these: //! For example, if we are comparing these:

View File

@ -1,7 +1,5 @@
use std::thread; use std::thread;
use build_helper::git::get_closest_merge_commit;
use super::*; use super::*;
use crate::Flags; use crate::Flags;
use crate::core::build_steps::doc::DocumentationFormat; use crate::core::build_steps::doc::DocumentationFormat;
@ -214,8 +212,6 @@ fn alias_and_path_for_library() {
assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]); assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]);
} }
// FIXME: This is failing in various runners in merge CI.
#[ignore]
#[test] #[test]
fn ci_rustc_if_unchanged_logic() { fn ci_rustc_if_unchanged_logic() {
let config = Config::parse_inner( let config = Config::parse_inner(
@ -227,10 +223,6 @@ fn ci_rustc_if_unchanged_logic() {
|&_| Ok(Default::default()), |&_| Ok(Default::default()),
); );
if config.rust_info.is_from_tarball() {
return;
}
let build = Build::new(config.clone()); let build = Build::new(config.clone());
let builder = Builder::new(&build); let builder = Builder::new(&build);
@ -240,26 +232,17 @@ fn ci_rustc_if_unchanged_logic() {
builder.run_step_descriptions(&Builder::get_step_descriptions(config.cmd.kind()), &[]); builder.run_step_descriptions(&Builder::get_step_descriptions(config.cmd.kind()), &[]);
let compiler_path = build.src.join("compiler"); // Make sure "if-unchanged" logic doesn't try to use CI rustc while there are changes
let library_path = build.src.join("library"); // in compiler and/or library.
if config.download_rustc_commit.is_some() {
let has_changes =
config.last_modified_commit(&["compiler", "library"], "download-rustc", true).is_none();
let commit = assert!(
get_closest_merge_commit(Some(&builder.config.src), &builder.config.git_config(), &[ !has_changes,
compiler_path.clone(), "CI-rustc can't be used with 'if-unchanged' while there are changes in compiler and/or library."
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());
} }
mod defaults { mod defaults {