Skip to content

Commit c435357

Browse files
committed
Bootstrap: Add testsuite for compiletest tool
The (currently) single unit test of the compiletest tool was never executed on CI. At least I couldn't find any references of it in the logs. This adds a test suite for compiletest so that our tester is tested, too. The compiletest tests can then also be executed with: ./x.py test src/tools/compiletest
1 parent f4b07e0 commit c435357

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ impl<'a> Builder<'a> {
416416
test::Rustfmt,
417417
test::Miri,
418418
test::Clippy,
419+
test::CompiletestTest,
419420
test::RustdocJS,
420421
test::RustdocTheme,
421422
// Run bootstrap close to the end as it's unlikely to fail

src/bootstrap/test.rs

+39
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,45 @@ impl Step for Miri {
429429
}
430430
}
431431

432+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
433+
pub struct CompiletestTest {
434+
stage: u32,
435+
host: Interned<String>,
436+
}
437+
438+
impl Step for CompiletestTest {
439+
type Output = ();
440+
441+
fn should_run(run: ShouldRun) -> ShouldRun {
442+
run.path("src/tools/compiletest")
443+
}
444+
445+
fn make_run(run: RunConfig) {
446+
run.builder.ensure(CompiletestTest {
447+
stage: run.builder.top_stage,
448+
host: run.target,
449+
});
450+
}
451+
452+
/// Runs `cargo test` for compiletest.
453+
fn run(self, builder: &Builder) {
454+
let stage = self.stage;
455+
let host = self.host;
456+
let compiler = builder.compiler(stage, host);
457+
458+
let mut cargo = tool::prepare_tool_cargo(builder,
459+
compiler,
460+
Mode::ToolBootstrap,
461+
host,
462+
"test",
463+
"src/tools/compiletest",
464+
SourceType::InTree,
465+
&[]);
466+
467+
try_run(builder, &mut cargo);
468+
}
469+
}
470+
432471
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
433472
pub struct Clippy {
434473
stage: u32,

0 commit comments

Comments
 (0)