Skip to content

Commit b644ddc

Browse files
committed
Add stdarch smoke test
1 parent 8121315 commit b644ddc

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
@@ -3533,6 +3533,68 @@ impl Step for CodegenGCC {
35333533
}
35343534
}
35353535

3536+
/// Smoke test for stdarch which simply checks if we can build it with the in-tree
3537+
/// compiler.
3538+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3539+
pub struct Stdarch {
3540+
compiler: Compiler,
3541+
target: TargetSelection,
3542+
}
3543+
3544+
impl Step for Stdarch {
3545+
type Output = ();
3546+
const DEFAULT: bool = true;
3547+
const ONLY_HOSTS: bool = true;
3548+
3549+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
3550+
run.paths(&["library/stdarch"])
3551+
}
3552+
3553+
fn make_run(run: RunConfig<'_>) {
3554+
let builder = run.builder;
3555+
let host = run.build_triple();
3556+
let compiler = run.builder.compiler_for(run.builder.top_stage, host, host);
3557+
3558+
builder.ensure(Stdarch { compiler, target: run.target });
3559+
}
3560+
3561+
fn run(self, builder: &Builder<'_>) {
3562+
let compiler = self.compiler;
3563+
let target = self.target;
3564+
3565+
builder.ensure(compile::Std::new(compiler, target));
3566+
3567+
let compiler = builder.compiler_for(compiler.stage, compiler.host, target);
3568+
3569+
let mut cargo = builder::Cargo::new(
3570+
builder,
3571+
compiler,
3572+
Mode::ToolRustc,
3573+
SourceType::InTree,
3574+
target,
3575+
Kind::Check,
3576+
);
3577+
3578+
cargo.current_dir(&builder.src.join("library/stdarch"));
3579+
cargo.arg("--manifest-path").arg(builder.src.join("library/stdarch/Cargo.toml"));
3580+
3581+
// Just check that we can compile core_arch for the given target
3582+
cargo.arg("-p").arg("core_arch").arg("--all-targets");
3583+
cargo.env("TARGET", target.triple);
3584+
3585+
builder.info(&format!(
3586+
"{} stdarch stage{} ({} -> {})",
3587+
Kind::Test.description(),
3588+
compiler.stage,
3589+
&compiler.host,
3590+
target
3591+
));
3592+
let _time = helpers::timeit(builder);
3593+
3594+
cargo.into_cmd().run(builder);
3595+
}
3596+
}
3597+
35363598
/// Test step that does two things:
35373599
/// - Runs `cargo test` for the `src/tools/test-float-parse` tool.
35383600
/// - Invokes the `test-float-parse` tool to test the standard library's

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ impl<'a> Builder<'a> {
10231023
test::RustdocJson,
10241024
test::HtmlCheck,
10251025
test::RustInstaller,
1026+
test::Stdarch,
10261027
test::TestFloatParse,
10271028
test::CollectLicenseMetadata,
10281029
// Run bootstrap close to the end as it's unlikely to fail

0 commit comments

Comments
 (0)