Skip to content

Commit

Permalink
Configure test execution for the build_helper crate in bootstrap
Browse files Browse the repository at this point in the history
To enable the previously moved `DropBomb` tests.
  • Loading branch information
Kobzol committed Jul 12, 2024
1 parent 97990a4 commit 49f54b8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,53 @@ impl Step for CrateRunMakeSupport {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CrateBuildHelper {
host: TargetSelection,
}

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

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/build_helper")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(CrateBuildHelper { host: run.target });
}

/// Runs `cargo test` for build_helper.
fn run(self, builder: &Builder<'_>) {
let host = self.host;
let compiler = builder.compiler(builder.top_stage, host);

builder.ensure(compile::Std::new(compiler, host));
let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolStd,
host,
"test",
"src/tools/build_helper",
SourceType::InTree,
&[],
);
cargo.allow_features("test");
run_cargo_test(
cargo,
&[],
&[],
"build_helper",
"build_helper self test",
compiler,
host,
builder,
);
}
}

default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });

default_test!(Crashes { path: "tests/crashes", mode: "crashes", suite: "crashes" });
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ impl<'a> Builder<'a> {
test::Clippy,
test::CompiletestTest,
test::CrateRunMakeSupport,
test::CrateBuildHelper,
test::RustdocJSStd,
test::RustdocJSNotStd,
test::RustdocGUI,
Expand Down

0 comments on commit 49f54b8

Please sign in to comment.