about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-11-19 15:35:19 +0100
committerGitHub <noreply@github.com>2022-11-19 15:35:19 +0100
commit4451e2881fbc7c066e8f44c1b09b69b0648e41d7 (patch)
treeb7ec0ac4f046a73c15df8453b5160f335d209ab0 /src/bootstrap
parent52cc0d5360622fe505b4f25973e06b1c9600f07c (diff)
parent470423c3d2cde3a62d5d4ac23840d734e8145366 (diff)
downloadrust-4451e2881fbc7c066e8f44c1b09b69b0648e41d7.tar.gz
rust-4451e2881fbc7c066e8f44c1b09b69b0648e41d7.zip
Rollup merge of #103969 - ferrocene:pa-download-rustc-ui-tests, r=jyn514
Partial support for running UI tests with `download-rustc`

Right now trying to run UI tests with `download-rustc` results in a bunch of test failures, requiring someone who wants to only work on tests to also build the full compiler. This PR **partially** addresses the problem by solving a lot of the errors (but not all).

* This installs the `rust-src` component on CI toolchains, since the test output depends on whether the standard library source code is installed; We can't just symlink the current source because the `rustc-dev` component already includes the compiler sources, but not the library sources, and mixing things is worse IMO.
* This ensures the `$SRC_DIR` normalization done by compiletest correctly handles the source code added above.
* This unconditionally sets `remap-prefix` to the prefix used in the downloaded toolchain, to ensure compiletest normalizes it.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/config.rs24
-rw-r--r--src/bootstrap/test.rs5
2 files changed, 20 insertions, 9 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index c61025b556a..babf09d2b93 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -1511,19 +1511,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> {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index fd362b8367c..b22b7ad4ae0 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1401,6 +1401,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
 
         cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite));
         cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
+        cmd.arg("--sysroot-base").arg(builder.sysroot(compiler));
         cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
         cmd.arg("--suite").arg(suite);
         cmd.arg("--mode").arg(mode);
@@ -1670,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!(