mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +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 build_helper::git::get_closest_merge_commit;
|
||||
|
||||
use super::*;
|
||||
use crate::Flags;
|
||||
use crate::core::build_steps::doc::DocumentationFormat;
|
||||
@ -223,31 +225,30 @@ fn ci_rustc_if_unchanged_logic() {
|
||||
|&_| Ok(Default::default()),
|
||||
);
|
||||
|
||||
let build = Build::new(config.clone());
|
||||
let builder = Builder::new(&build);
|
||||
|
||||
if config.rust_info.is_from_tarball() {
|
||||
return;
|
||||
}
|
||||
|
||||
let build = Build::new(config.clone());
|
||||
let builder = Builder::new(&build);
|
||||
|
||||
if config.out.exists() {
|
||||
fs::remove_dir_all(&config.out).unwrap();
|
||||
}
|
||||
|
||||
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),
|
||||
&builder.config.git_config(),
|
||||
&builder.config.stage0_metadata.config.git_merge_commit_email,
|
||||
&[],
|
||||
&[compiler_path.clone(), library_path.clone()],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let compiler_path = build.src.join("compiler");
|
||||
let library_path = build.src.join("library");
|
||||
|
||||
let has_changes = helpers::git(Some(&builder.src))
|
||||
let has_changes = !helpers::git(Some(&builder.src))
|
||||
.args(["diff-index", "--quiet", &commit])
|
||||
.arg("--")
|
||||
.args([compiler_path, library_path])
|
||||
@ -256,9 +257,7 @@ fn ci_rustc_if_unchanged_logic() {
|
||||
.unwrap()
|
||||
.success();
|
||||
|
||||
assert!(
|
||||
has_changes != config.out.join(config.build.to_string()).join("ci-rustc-sysroot").exists()
|
||||
);
|
||||
assert!(has_changes == config.download_rustc_commit.is_none());
|
||||
}
|
||||
|
||||
mod defaults {
|
||||
|
@ -2422,8 +2422,9 @@ impl Config {
|
||||
ci_config_toml,
|
||||
);
|
||||
|
||||
let disable_ci_rustc_if_incompatible =
|
||||
env::var_os("DISABLE_CI_RUSTC_IF_INCOMPATIBLE")
|
||||
// Primarily used by CI runners to avoid handling download-rustc 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");
|
||||
|
||||
if disable_ci_rustc_if_incompatible && res.is_err() {
|
||||
|
@ -55,7 +55,7 @@ ENV SCRIPT \
|
||||
git config --global user.name \"dummy\" && \
|
||||
git add ../compiler/rustc/src/main.rs && \
|
||||
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
|
||||
git reset --hard HEAD~1 && \
|
||||
|
||||
|
@ -52,7 +52,8 @@ if [ "$CI" != "" ]; then
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set change-id=99999999"
|
||||
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
|
||||
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user