summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-18 11:43:26 +0000
committerbors <bors@rust-lang.org>2023-04-18 11:43:26 +0000
commitde96f3d8735b70d5dc1ca178aaee198b329b8f3d (patch)
treef58f61901faa9865c6be25340a5bc949de205c3f /src/tools/compiletest
parent5fe3528be5ef12be3d12c7a9ee1b0bff9e3b35e4 (diff)
parentd6af60266eed9a19ee550278cdfe1d2857763286 (diff)
downloadrust-de96f3d8735b70d5dc1ca178aaee198b329b8f3d.tar.gz
rust-de96f3d8735b70d5dc1ca178aaee198b329b8f3d.zip
Auto merge of #110478 - jyn514:stage1-fulldeps, r=albertlarsan68
Support `x test --stage 1 ui-fulldeps`

`@Nilstrieb` had an excellent idea the other day: the same way that rustdoc is able to load `rustc_driver` from the sysroot, ui-fulldeps tests should also be able to load it from the sysroot. That allows us to run fulldeps tests with stage1, without having to fully rebuild the compiler twice. It does unfortunately have the downside that we're building the tests with the *bootstrap* compiler, not the in-tree sources, but since most of the fulldeps tests are for the *API* of the compiler, that seems ok.

I think it's possible to extend this to `run-make-fulldeps`, but I've run out of energy for tonight.

- Move `plugin` tests into a subdirectory.

  Plugins are loaded at runtime with `dlopen` and so require the ABI of the running compile to match the ABI of the compiler linked with `rustc_driver`. As a result they can't be supported in stage 1 and have to use `// ignore-stage1`.

- Remove `ignore-stage1` from most non-plugin tests

- Ignore diagnostic tests in stage 1. Even though this requires a stage 2 build to load rustc_driver, it's primarily testing the error message that the *running* compiler emits when the diagnostic struct is malformed.

- Pass `-Zforce-unstable-if-unmarked` in stage1, not just stage2. That allows running `hash-stable-is-unstable` in stage1, since it now suggests adding `rustc_private` to enable loading the crates.

- Add libLLVM.so to the stage0 target sysroot, to allow fulldeps tests that act as custom drivers to load it at runtime.

- Pass `--sysroot stage0-sysroot` in compiletest so that we use the correct version of std.

- Move a few lint tests from ui-fulldeps to ui

  These had an `aux-build:lint-group-plugin-test.rs` that they never actually loaded with `feature(plugin)` nor tested. I removed the unused aux-build and they pass fine with stage 1.

Fixes https://github.com/rust-lang/rust/issues/75905.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/common.rs4
-rw-r--r--src/tools/compiletest/src/runtest.rs3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 3f36cc5bbcc..7166d99d792 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -422,7 +422,9 @@ pub struct TargetCfgs {
 
 impl TargetCfgs {
     fn new(config: &Config) -> TargetCfgs {
-        let targets: HashMap<String, TargetCfg> = if config.stage_id.starts_with("stage0-") {
+        let targets: HashMap<String, TargetCfg> = if config.stage_id.starts_with("stage0-")
+            || (config.suite == "ui-fulldeps" && config.stage_id.starts_with("stage1-"))
+        {
             // #[cfg(bootstrap)]
             // Needed only for one cycle, remove during the bootstrap bump.
             Self::collect_all_slow(config)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 0fa5c54ae8e..1a4e9b58383 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1900,6 +1900,9 @@ impl<'test> TestCx<'test> {
         // Use a single thread for efficiency and a deterministic error message order
         rustc.arg("-Zthreads=1");
 
+        // In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
+        rustc.arg("--sysroot").arg(&self.config.sysroot_base);
+
         // Optionally prevent default --target if specified in test compile-flags.
         let custom_target = self.props.compile_flags.iter().any(|x| x.starts_with("--target"));