Skip to content

Commit 1a8fe8b

Browse files
committed
coverage: Add ./x.py test coverage, an alias for coverage-map and run-coverage
1 parent ee33712 commit 1a8fe8b

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

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

+45
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,51 @@ host_test!(RunMakeFullDeps {
13491349

13501350
default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" });
13511351

1352+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1353+
pub struct Coverage {
1354+
pub compiler: Compiler,
1355+
pub target: TargetSelection,
1356+
}
1357+
1358+
impl Coverage {
1359+
const SUITE: &'static str = "coverage";
1360+
}
1361+
1362+
impl Step for Coverage {
1363+
type Output = ();
1364+
const DEFAULT: bool = false;
1365+
const ONLY_HOSTS: bool = false;
1366+
1367+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1368+
run.alias(Self::SUITE)
1369+
}
1370+
1371+
fn make_run(run: RunConfig<'_>) {
1372+
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
1373+
1374+
run.builder.ensure(Coverage { compiler, target: run.target });
1375+
}
1376+
1377+
fn run(self, builder: &Builder<'_>) {
1378+
builder.ensure(Compiletest {
1379+
compiler: self.compiler,
1380+
target: self.target,
1381+
mode: "coverage-map",
1382+
suite: "coverage-map",
1383+
path: "tests/coverage-map",
1384+
compare_mode: None,
1385+
});
1386+
builder.ensure(Compiletest {
1387+
compiler: self.compiler,
1388+
target: self.target,
1389+
mode: "run-coverage",
1390+
suite: "run-coverage",
1391+
path: "tests/run-coverage",
1392+
compare_mode: None,
1393+
});
1394+
}
1395+
}
1396+
13521397
default_test!(CoverageMap {
13531398
path: "tests/coverage-map",
13541399
mode: "coverage-map",

src/bootstrap/src/core/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ impl<'a> Builder<'a> {
727727
test::Tidy,
728728
test::Ui,
729729
test::RunPassValgrind,
730+
test::Coverage,
730731
test::CoverageMap,
731732
test::RunCoverage,
732733
test::MirOpt,

0 commit comments

Comments
 (0)