mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-06 15:07:36 +00:00
fix ci_rustc_if_unchanged_logic
test
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
8a5f418f14
commit
abac4dc888
@ -1,5 +1,7 @@
|
|||||||
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;
|
||||||
@ -223,31 +225,30 @@ fn ci_rustc_if_unchanged_logic() {
|
|||||||
|&_| Ok(Default::default()),
|
|&_| Ok(Default::default()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let build = Build::new(config.clone());
|
|
||||||
let builder = Builder::new(&build);
|
|
||||||
|
|
||||||
if config.rust_info.is_from_tarball() {
|
if config.rust_info.is_from_tarball() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let build = Build::new(config.clone());
|
||||||
|
let builder = Builder::new(&build);
|
||||||
|
|
||||||
if config.out.exists() {
|
if config.out.exists() {
|
||||||
fs::remove_dir_all(&config.out).unwrap();
|
fs::remove_dir_all(&config.out).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.run_step_descriptions(&Builder::get_step_descriptions(config.cmd.kind()), &[]);
|
builder.run_step_descriptions(&Builder::get_step_descriptions(config.cmd.kind()), &[]);
|
||||||
|
|
||||||
let commit = helpers::get_closest_merge_base_commit(
|
let compiler_path = build.src.join("compiler");
|
||||||
|
let library_path = build.src.join("compiler");
|
||||||
|
|
||||||
|
let commit = get_closest_merge_commit(
|
||||||
Some(&builder.config.src),
|
Some(&builder.config.src),
|
||||||
&builder.config.git_config(),
|
&builder.config.git_config(),
|
||||||
&builder.config.stage0_metadata.config.git_merge_commit_email,
|
&[compiler_path.clone(), library_path.clone()],
|
||||||
&[],
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let compiler_path = build.src.join("compiler");
|
let has_changes = !helpers::git(Some(&builder.src))
|
||||||
let library_path = build.src.join("library");
|
|
||||||
|
|
||||||
let has_changes = helpers::git(Some(&builder.src))
|
|
||||||
.args(["diff-index", "--quiet", &commit])
|
.args(["diff-index", "--quiet", &commit])
|
||||||
.arg("--")
|
.arg("--")
|
||||||
.args([compiler_path, library_path])
|
.args([compiler_path, library_path])
|
||||||
@ -256,9 +257,7 @@ fn ci_rustc_if_unchanged_logic() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.success();
|
.success();
|
||||||
|
|
||||||
assert!(
|
assert!(has_changes == config.download_rustc_commit.is_none());
|
||||||
has_changes != config.out.join(config.build.to_string()).join("ci-rustc-sysroot").exists()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mod defaults {
|
mod defaults {
|
||||||
|
@ -2422,8 +2422,9 @@ impl Config {
|
|||||||
ci_config_toml,
|
ci_config_toml,
|
||||||
);
|
);
|
||||||
|
|
||||||
let disable_ci_rustc_if_incompatible =
|
// Primarily used by CI runners to avoid handling download-rustc incompatible
|
||||||
env::var_os("DISABLE_CI_RUSTC_IF_INCOMPATIBLE")
|
// options one by one on shell scripts.
|
||||||
|
let disable_ci_rustc_if_incompatible = env::var_os("DISABLE_CI_RUSTC_IF_INCOMPATIBLE")
|
||||||
.is_some_and(|s| s == "1" || s == "true");
|
.is_some_and(|s| s == "1" || s == "true");
|
||||||
|
|
||||||
if disable_ci_rustc_if_incompatible && res.is_err() {
|
if disable_ci_rustc_if_incompatible && res.is_err() {
|
||||||
|
@ -55,7 +55,7 @@ ENV SCRIPT \
|
|||||||
git config --global user.name \"dummy\" && \
|
git config --global user.name \"dummy\" && \
|
||||||
git add ../compiler/rustc/src/main.rs && \
|
git add ../compiler/rustc/src/main.rs && \
|
||||||
git commit -m \"test commit for rust.download-rustc=if-unchanged logic\" && \
|
git commit -m \"test commit for rust.download-rustc=if-unchanged logic\" && \
|
||||||
python3 ../x.py test bootstrap -- core::builder::tests::ci_rustc_if_unchanged_logic && \
|
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 python3 ../x.py test bootstrap -- core::builder::tests::ci_rustc_if_unchanged_logic && \
|
||||||
# Revert the dummy commit
|
# Revert the dummy commit
|
||||||
git reset --hard HEAD~1 && \
|
git reset --hard HEAD~1 && \
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ if [ "$CI" != "" ]; then
|
|||||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set change-id=99999999"
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set change-id=99999999"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined, switch to in-tree rustc.
|
# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined,
|
||||||
|
# switch to in-tree rustc.
|
||||||
if [ "$FORCE_CI_RUSTC" == "" ]; then
|
if [ "$FORCE_CI_RUSTC" == "" ]; then
|
||||||
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1
|
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user