Skip to content

Commit 5b92c2b

Browse files
committed
Add stdarch smoke test
1 parent 69f408a commit 5b92c2b

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,6 +3537,71 @@ impl Step for CodegenGCC {
35373537
}
35383538
}
35393539

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

0 commit comments

Comments
 (0)