Skip to content

Commit 5e9bb04

Browse files
committed
Add stdarch smoke test
1 parent 86e05cd commit 5e9bb04

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3552,6 +3552,65 @@ impl Step for CodegenGCC {
35523552
}
35533553
}
35543554

3555+
/// Smoke test for stdarch which simply checks if we can build it with the in-tree
3556+
/// compiler.
3557+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3558+
pub struct Stdarch {
3559+
compiler: Compiler,
3560+
target: TargetSelection,
3561+
}
3562+
3563+
impl Step for Stdarch {
3564+
type Output = ();
3565+
const DEFAULT: bool = true;
3566+
const ONLY_HOSTS: bool = true;
3567+
3568+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
3569+
run.paths(&["library/stdarch"])
3570+
}
3571+
3572+
fn make_run(run: RunConfig<'_>) {
3573+
let builder = run.builder;
3574+
let host = run.build_triple();
3575+
let compiler = run.builder.compiler(run.builder.top_stage, host);
3576+
3577+
builder.ensure(Stdarch { compiler, target: run.target });
3578+
}
3579+
3580+
fn run(self, builder: &Builder<'_>) {
3581+
let compiler = self.compiler;
3582+
let target = self.target;
3583+
3584+
builder.ensure(compile::Std::new(compiler, target));
3585+
3586+
let mut cargo = builder::Cargo::new(
3587+
builder,
3588+
compiler,
3589+
Mode::ToolRustc,
3590+
SourceType::InTree,
3591+
target,
3592+
Kind::Check,
3593+
);
3594+
3595+
cargo.current_dir(&builder.src.join("library/stdarch"));
3596+
cargo.arg("--manifest-path").arg(builder.src.join("library/stdarch/Cargo.toml"));
3597+
3598+
// Just check that we can compile core_arch and std_detect for the given target
3599+
cargo.arg("-p").arg("core_arch").arg("--all-targets").env("TARGET", target.triple);
3600+
3601+
builder.info(&format!(
3602+
"{} stdarch stage{} ({} -> {})",
3603+
Kind::Test.description(),
3604+
compiler.stage,
3605+
&compiler.host,
3606+
target
3607+
));
3608+
let _time = helpers::timeit(builder);
3609+
3610+
cargo.into_cmd().run(builder);
3611+
}
3612+
}
3613+
35553614
/// Test step that does two things:
35563615
/// - Runs `cargo test` for the `src/tools/test-float-parse` tool.
35573616
/// - 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
@@ -1077,6 +1077,7 @@ impl<'a> Builder<'a> {
10771077
test::RustdocJson,
10781078
test::HtmlCheck,
10791079
test::RustInstaller,
1080+
test::Stdarch,
10801081
test::TestFloatParse,
10811082
test::CollectLicenseMetadata,
10821083
// Run bootstrap close to the end as it's unlikely to fail

0 commit comments

Comments
 (0)