diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-11-01 20:02:09 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-11-07 11:15:19 +1100 |
| commit | 3509aed632dd7badac18b071bcd7e1ca53f9d1c6 (patch) | |
| tree | 712918feb07b4e210f0dc46c5d2811ddaa721f64 | |
| parent | e585a992300093c13e477f2eb7e66842d9275131 (diff) | |
| download | rust-3509aed632dd7badac18b071bcd7e1ca53f9d1c6.tar.gz rust-3509aed632dd7badac18b071bcd7e1ca53f9d1c6.zip | |
coverage: Add `./x.py test coverage`, an alias for `coverage-map` and `run-coverage`
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 50 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index e2b515a3086..c964d220cc3 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1349,6 +1349,56 @@ host_test!(RunMakeFullDeps { default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" }); +/// Custom test step that is responsible for running the coverage tests +/// in multiple different modes. +/// +/// Each individual mode also has its own alias that will run the tests in +/// just that mode. +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct Coverage { + pub compiler: Compiler, + pub target: TargetSelection, +} + +impl Coverage { + const SUITE: &'static str = "coverage"; +} + +impl Step for Coverage { + type Output = (); + const DEFAULT: bool = false; + const ONLY_HOSTS: bool = false; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.alias(Self::SUITE) + } + + fn make_run(run: RunConfig<'_>) { + let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple()); + + run.builder.ensure(Coverage { compiler, target: run.target }); + } + + fn run(self, builder: &Builder<'_>) { + builder.ensure(Compiletest { + compiler: self.compiler, + target: self.target, + mode: "coverage-map", + suite: "coverage-map", + path: "tests/coverage-map", + compare_mode: None, + }); + builder.ensure(Compiletest { + compiler: self.compiler, + target: self.target, + mode: "run-coverage", + suite: "run-coverage", + path: "tests/run-coverage", + compare_mode: None, + }); + } +} + default_test!(CoverageMap { path: "tests/coverage-map", mode: "coverage-map", diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 44cdbe38de3..38eb4633273 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -727,6 +727,7 @@ impl<'a> Builder<'a> { test::Tidy, test::Ui, test::RunPassValgrind, + test::Coverage, test::CoverageMap, test::RunCoverage, test::MirOpt, |
