Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2731,6 +2731,58 @@ impl Step for Crate {
}
}

/// Test compiler-builtins via its testcrate.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CompilerBuiltins {
compiler: Compiler,
target: TargetSelection,
}

impl Step for CompilerBuiltins {
type Output = ();
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("library/compiler-builtins")
}

fn make_run(run: RunConfig<'_>) {
let builder = run.builder;
let host = run.build_triple();
let compiler = builder.compiler(builder.top_stage, host);

builder.ensure(CompilerBuiltins { compiler, target: run.target });
}

fn run(self, builder: &Builder<'_>) -> Self::Output {
let compiler = self.compiler;
let target = self.target;

builder.ensure(compile::Std::new(compiler, target));

let make_cargo = |f: fn(&mut builder::Cargo) -> &mut builder::Cargo| {
let mut c = builder::Cargo::new(
builder,
compiler,
Mode::ToolStd,
SourceType::InTree,
target,
Kind::Test,
);
c.current_dir(&builder.src.join("library").join("compiler-builtins"));
f(&mut c);
c
};

// Most tests are in the builtins-test crate.
let crates = ["compiler_builtins".to_string(), "builtins-test".to_string()];
let cargo = make_cargo(|c| c);
run_cargo_test(cargo, &[], &crates, "compiler-builtins", target, builder);
let cargo = make_cargo(|c| c.arg("--features=c"));
run_cargo_test(cargo, &[], &crates, "compiler-builtins --features c", target, builder);
}
}

/// Rustdoc is special in various ways, which is why this step is different from `Crate`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CrateRustdoc {
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ impl<'a> Builder<'a> {
test::HtmlCheck,
test::RustInstaller,
test::TestFloatParse,
test::CompilerBuiltins,
test::CollectLicenseMetadata,
// Run bootstrap close to the end as it's unlikely to fail
test::Bootstrap,
Expand Down
Loading