normalize download-rustc's prefix when running compiletests
This commit is contained in:
parent
80d535966c
commit
470423c3d2
3 changed files with 21 additions and 9 deletions
|
@ -1506,19 +1506,25 @@ impl Config {
|
|||
|
||||
/// Return whether we will use a downloaded, pre-compiled version of rustc, or just build from source.
|
||||
pub(crate) fn download_rustc(&self) -> bool {
|
||||
static DOWNLOAD_RUSTC: OnceCell<bool> = OnceCell::new();
|
||||
self.download_rustc_commit().is_some()
|
||||
}
|
||||
|
||||
pub(crate) fn download_rustc_commit(&self) -> Option<&'static str> {
|
||||
static DOWNLOAD_RUSTC: OnceCell<Option<String>> = OnceCell::new();
|
||||
if self.dry_run() && DOWNLOAD_RUSTC.get().is_none() {
|
||||
// avoid trying to actually download the commit
|
||||
return false;
|
||||
return None;
|
||||
}
|
||||
|
||||
*DOWNLOAD_RUSTC.get_or_init(|| match &self.download_rustc_commit {
|
||||
None => false,
|
||||
Some(commit) => {
|
||||
self.download_ci_rustc(commit);
|
||||
true
|
||||
}
|
||||
})
|
||||
DOWNLOAD_RUSTC
|
||||
.get_or_init(|| match &self.download_rustc_commit {
|
||||
None => None,
|
||||
Some(commit) => {
|
||||
self.download_ci_rustc(commit);
|
||||
Some(commit.clone())
|
||||
}
|
||||
})
|
||||
.as_deref()
|
||||
}
|
||||
|
||||
pub(crate) fn initial_rustfmt(&self) -> Option<PathBuf> {
|
||||
|
|
|
@ -1671,6 +1671,10 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||
|
||||
cmd.arg("--channel").arg(&builder.config.channel);
|
||||
|
||||
if let Some(commit) = builder.config.download_rustc_commit() {
|
||||
cmd.env("FAKE_DOWNLOAD_RUSTC_PREFIX", format!("/rustc/{commit}"));
|
||||
}
|
||||
|
||||
builder.ci_env.force_coloring_in_ci(&mut cmd);
|
||||
|
||||
builder.info(&format!(
|
||||
|
|
|
@ -3536,6 +3536,8 @@ impl<'test> TestCx<'test> {
|
|||
Some(self.config.sysroot_base.join("lib").join("rustlib").join("src").join("rust")),
|
||||
// Virtual `/rustc/$sha` remapped paths (if `remap-debuginfo` is enabled):
|
||||
option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from),
|
||||
// Virtual `/rustc/$sha` coming from download-rustc:
|
||||
std::env::var_os("FAKE_DOWNLOAD_RUSTC_PREFIX").map(PathBuf::from),
|
||||
];
|
||||
for base_dir in source_bases {
|
||||
if let Some(base_dir) = base_dir {
|
||||
|
|
Loading…
Add table
Reference in a new issue