Skip to content

Commit 9adafa7

Browse files
committed
Auto merge of #124321 - JoverZhang:run-make-support-tests, r=onur-ozkan
Add support for run-make-support unit tests to be run with bootstrap The `run-make-support` library needs to run its unit tests to ensure it is correct. Close #124267
2 parents 5ff8fbb + c028782 commit 9adafa7

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

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

+48
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,53 @@ impl Step for RunMakeSupport {
13971398
}
13981399
}
13991400

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

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

src/bootstrap/src/core/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ impl<'a> Builder<'a> {
817817
test::Clippy,
818818
test::RustDemangler,
819819
test::CompiletestTest,
820+
test::CrateRunMakeSupport,
820821
test::RustdocJSStd,
821822
test::RustdocJSNotStd,
822823
test::RustdocGUI,

0 commit comments

Comments
 (0)