Skip to content

Commit 66b13d9

Browse files
committed
Add compiler-builtins to bootstrap
1 parent 076ec59 commit 66b13d9

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,6 +2731,68 @@ impl Step for Crate {
27312731
}
27322732
}
27332733

2734+
/// Test compiler-builtins via its testcrate.
2735+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2736+
pub struct CompilerBuiltins {
2737+
compiler: Compiler,
2738+
target: TargetSelection,
2739+
mode: Mode,
2740+
}
2741+
2742+
impl Step for CompilerBuiltins {
2743+
type Output = ();
2744+
const DEFAULT: bool = true;
2745+
2746+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2747+
run.paths(&["library/compiler-builtins", "library/compiler-builtins/compiler-builtins"])
2748+
}
2749+
2750+
fn make_run(run: RunConfig<'_>) {
2751+
let builder = run.builder;
2752+
let host = run.build_triple();
2753+
let compiler = builder.compiler_for(builder.top_stage, host, host);
2754+
2755+
builder.ensure(CompilerBuiltins { compiler, target: run.target, mode: Mode::Std });
2756+
}
2757+
2758+
fn run(self, builder: &Builder<'_>) -> Self::Output {
2759+
let compiler = self.compiler;
2760+
let target = self.target;
2761+
let mode = self.mode;
2762+
2763+
builder.ensure(compile::Std::new(compiler, compiler.host).force_recompile(true));
2764+
let compiler = builder.compiler_for(compiler.stage, compiler.host, target);
2765+
2766+
// Also prepare a sysroot for the target.
2767+
if !builder.config.is_host_target(target) {
2768+
builder.ensure(compile::Std::new(compiler, target).force_recompile(true));
2769+
builder.ensure(RemoteCopyLibs { compiler, target });
2770+
}
2771+
2772+
let make_cargo = |f: fn(&mut builder::Cargo) -> &mut builder::Cargo| {
2773+
let mut c = builder::Cargo::new(
2774+
builder,
2775+
compiler,
2776+
mode,
2777+
SourceType::InTree,
2778+
target,
2779+
Kind::Test,
2780+
);
2781+
f(&mut c);
2782+
c
2783+
};
2784+
2785+
// Most tests are in the builtins-test crate.
2786+
let crates = ["compiler-builtins".to_string(), "builtins-test".to_string()];
2787+
let cargo = make_cargo(|c| c);
2788+
run_cargo_test(cargo, &[], &crates, "compiler-buitlins", target, builder);
2789+
let cargo = make_cargo(|c| c.arg("--release"));
2790+
run_cargo_test(cargo, &[], &crates, "compiler-buitlins --release", target, builder);
2791+
let cargo = make_cargo(|c| c.arg("--features=c"));
2792+
run_cargo_test(cargo, &[], &crates, "compiler-buitlins --features c", target, builder);
2793+
}
2794+
}
2795+
27342796
/// Rustdoc is special in various ways, which is why this step is different from `Crate`.
27352797
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
27362798
pub struct CrateRustdoc {

src/bootstrap/src/core/builder/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,7 @@ impl<'a> Builder<'a> {
10241024
test::HtmlCheck,
10251025
test::RustInstaller,
10261026
test::TestFloatParse,
1027+
test::CompilerBuiltins,
10271028
test::CollectLicenseMetadata,
10281029
// Run bootstrap close to the end as it's unlikely to fail
10291030
test::Bootstrap,

0 commit comments

Comments
 (0)