Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d6af602

Browse files
committedApr 18, 2023
Support x test --stage 1 ui-fulldeps
Nils 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 running the tests on 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.
1 parent ce1073b commit d6af602

File tree

72 files changed

+236
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+236
-204
lines changed
 

‎src/bootstrap/bin/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn main() {
150150
// allow the `rustc_private` feature to link to other unstable crates
151151
// also in the sysroot. We also do this for host crates, since those
152152
// may be proc macros, in which case we might ship them.
153-
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() && (stage != "0" || target.is_some()) {
153+
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
154154
cmd.arg("-Z").arg("force-unstable-if-unmarked");
155155
}
156156

‎src/bootstrap/builder.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,9 +1008,24 @@ impl<'a> Builder<'a> {
10081008
// Avoid deleting the rustlib/ directory we just copied
10091009
// (in `impl Step for Sysroot`).
10101010
if !builder.download_rustc() {
1011+
builder.verbose(&format!(
1012+
"Removing sysroot {} to avoid caching bugs",
1013+
sysroot.display()
1014+
));
10111015
let _ = fs::remove_dir_all(&sysroot);
10121016
t!(fs::create_dir_all(&sysroot));
10131017
}
1018+
1019+
if self.compiler.stage == 0 {
1020+
// The stage 0 compiler for the build triple is always pre-built.
1021+
// Ensure that `libLLVM.so` ends up in the target libdir, so that ui-fulldeps tests can use it when run.
1022+
dist::maybe_install_llvm_target(
1023+
builder,
1024+
self.compiler.host,
1025+
&builder.sysroot(self.compiler),
1026+
);
1027+
}
1028+
10141029
INTERNER.intern_path(sysroot)
10151030
}
10161031
}

0 commit comments

Comments
 (0)