Skip to content

Commit 9821098

Browse files
committed
Add support for run-make-support unit tests to be run with bootstrap command
1 parent c1feb3e commit 9821098

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,7 @@ impl Step for RunMakeSupport {
13711371
run.builder.ensure(RunMakeSupport { compiler, target: run.build_triple() });
13721372
}
13731373

1374+
/// Builds run-make-support and returns the path to the resulting rlib.
13741375
fn run(self, builder: &Builder<'_>) -> PathBuf {
13751376
builder.ensure(compile::Std::new(self.compiler, self.target));
13761377

@@ -1397,6 +1398,52 @@ impl Step for RunMakeSupport {
13971398
}
13981399
}
13991400

1401+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1402+
pub struct RunMakeSupportTest {
1403+
host: TargetSelection,
1404+
}
1405+
1406+
impl Step for RunMakeSupportTest {
1407+
type Output = ();
1408+
1409+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1410+
run.path("src/tools/run-make-support")
1411+
}
1412+
1413+
fn make_run(run: RunConfig<'_>) {
1414+
run.builder.ensure(RunMakeSupportTest { host: run.target });
1415+
}
1416+
1417+
/// Runs `cargo test` for run-make-support.
1418+
fn run(self, builder: &Builder<'_>) {
1419+
let host = self.host;
1420+
let compiler = builder.compiler(builder.top_stage, host);
1421+
1422+
builder.ensure(compile::Std::new(compiler, host));
1423+
let mut cargo = tool::prepare_tool_cargo(
1424+
builder,
1425+
compiler,
1426+
Mode::ToolStd,
1427+
host,
1428+
"test",
1429+
"src/tools/run-make-support",
1430+
SourceType::InTree,
1431+
&[],
1432+
);
1433+
cargo.allow_features("test");
1434+
run_cargo_test(
1435+
cargo,
1436+
&[],
1437+
&[],
1438+
"run-make-support",
1439+
"run-make-support self test",
1440+
compiler,
1441+
host,
1442+
builder,
1443+
);
1444+
}
1445+
}
1446+
14001447
default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });
14011448

14021449
default_test!(Crashes { path: "tests/crashes", mode: "crashes", suite: "crashes" });

src/bootstrap/src/core/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ impl<'a> Builder<'a> {
829829
test::Bootstrap,
830830
// Run run-make last, since these won't pass without make on Windows
831831
test::RunMake,
832+
test::RunMakeSupportTest,
832833
),
833834
Kind::Miri => describe!(test::Crate),
834835
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),

0 commit comments

Comments
 (0)