Skip to content

Add stdarch bootstrap smoke test #143285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
59 changes: 59 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,65 @@ impl Step for CodegenGCC {
}
}

/// Smoke test for stdarch which simply checks if we can build it with the in-tree
/// compiler.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Stdarch {
compiler: Compiler,
target: TargetSelection,
}

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

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.paths(&["library/stdarch"])
}

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

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

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

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

let mut cargo = builder::Cargo::new(
builder,
compiler,
Mode::ToolRustc,
SourceType::InTree,
target,
Kind::Check,
);

cargo.current_dir(&builder.src.join("library/stdarch"));
cargo.arg("--manifest-path").arg(builder.src.join("library/stdarch/Cargo.toml"));

// Just check that we can compile core_arch and std_detect for the given target
cargo.arg("-p").arg("core_arch").arg("--all-targets").env("TARGET", target.triple);

builder.info(&format!(
"{} stdarch stage{} ({} -> {})",
Kind::Test.description(),
compiler.stage,
&compiler.host,
target
));
let _time = helpers::timeit(builder);

cargo.into_cmd().run(builder);
}
}

/// Test step that does two things:
/// - Runs `cargo test` for the `src/tools/test-float-parse` tool.
/// - Invokes the `test-float-parse` tool to test the standard library's
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 @@ -1077,6 +1077,7 @@ impl<'a> Builder<'a> {
test::RustdocJson,
test::HtmlCheck,
test::RustInstaller,
test::Stdarch,
test::TestFloatParse,
test::CollectLicenseMetadata,
// Run bootstrap close to the end as it's unlikely to fail
Expand Down
Loading