Skip to content

Commit 4e6f438

Browse files
committed
coverage: Register test::Coverage as the test suite for tests/coverage
This restores the ability to run a coverage test by specifying its path, e.g. `./x.py test tests/coverage/if.rs`. This runs the test in both modes.
1 parent 49127c6 commit 4e6f438

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ impl Step for Coverage {
14231423
const ONLY_HOSTS: bool = false;
14241424

14251425
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1426-
run.alias(Self::SUITE)
1426+
run.suite_path(Self::PATH)
14271427
}
14281428

14291429
fn make_run(run: RunConfig<'_>) {
@@ -1438,6 +1438,7 @@ impl Step for Coverage {
14381438
}
14391439
}
14401440

1441+
// Aliases for running the coverage tests in only one mode.
14411442
coverage_test_alias!(CoverageMap {
14421443
alias_and_mode: "coverage-map",
14431444
default: true,

tests/coverage/README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Many of these tests were copied from `tests/run-coverage` in order to
2-
capture the current behavior of the instrumentor on non-trivial programs.
3-
The actual mappings have not been closely inspected.
1+
The tests in this directory are shared by two different test modes, and can be
2+
run in multiple different ways:
3+
4+
- `./x.py test coverage-map` (compiles to LLVM IR and checks coverage mappings)
5+
- `./x.py test run-coverage` (runs a test binary and checks its coverage report)
6+
- `./x.py test coverage` (runs both `coverage-map` and `run-coverage`)
47

58
## Maintenance note
69

710
These tests can be sensitive to small changes in MIR spans or MIR control flow,
811
especially in HIR-to-MIR lowering or MIR optimizations.
912

10-
If you haven't touched the coverage code directly, and the `run-coverage` test
11-
suite still works, then it should usually be OK to just `--bless` these
12-
coverage mapping tests as necessary, without worrying too much about the exact
13-
changes.
13+
If you haven't touched the coverage code directly, and the tests still pass in
14+
`run-coverage` mode, then it should usually be OK to just re-bless the mappings
15+
as necessary with `./x.py test coverage-map --bless`, without worrying too much
16+
about the exact changes.

0 commit comments

Comments
 (0)