From 564d17af3013f649b0aa92b60e707fe0b097b544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 11 Mar 2025 11:53:57 +0100 Subject: [PATCH] Do not download GCC in tests --- src/bootstrap/src/core/build_steps/gcc.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/gcc.rs b/src/bootstrap/src/core/build_steps/gcc.rs index 7e1ec39659a30..8e855e37587a8 100644 --- a/src/bootstrap/src/core/build_steps/gcc.rs +++ b/src/bootstrap/src/core/build_steps/gcc.rs @@ -17,7 +17,7 @@ use build_helper::git::get_closest_merge_commit; use crate::Config; use crate::core::builder::{Builder, Cargo, Kind, RunConfig, ShouldRun, Step}; -use crate::core::config::{GccCiMode, TargetSelection}; +use crate::core::config::TargetSelection; use crate::utils::build_stamp::{BuildStamp, generate_smart_stamp_hash}; use crate::utils::exec::command; use crate::utils::helpers::{self, t}; @@ -93,9 +93,10 @@ pub enum GccBuildStatus { /// Tries to download GCC from CI if it is enabled and GCC artifacts /// are available for the given target. /// Returns a path to the libgccjit.so file. +#[cfg(not(test))] fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option { // Try to download GCC from CI if configured and available - if !matches!(builder.config.gcc_ci_mode, GccCiMode::DownloadFromCi) { + if !matches!(builder.config.gcc_ci_mode, crate::core::config::GccCiMode::DownloadFromCi) { return None; } if target != "x86_64-unknown-linux-gnu" { @@ -114,6 +115,11 @@ fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option, _target: TargetSelection) -> Option { + None +} + /// This returns information about whether GCC should be built or if it's already built. /// It transparently handles downloading GCC from CI if needed. /// @@ -247,11 +253,13 @@ pub fn add_cg_gcc_cargo_flags(cargo: &mut Cargo, gcc: &GccOutput) { } /// The absolute path to the downloaded GCC artifacts. +#[cfg(not(test))] fn ci_gcc_root(config: &Config) -> PathBuf { config.out.join(config.build).join("ci-gcc") } /// This retrieves the GCC sha we *want* to use, according to git history. +#[cfg(not(test))] fn detect_gcc_sha(config: &Config, is_git: bool) -> String { let gcc_sha = if is_git { get_closest_merge_commit(