rust/tests/coverage
Nadrieril e8678b1030
Rollup merge of #120015 - Zalathar:format, r=dtolnay
coverage: Format all coverage tests with `rustfmt`

As suggested by <https://github.com/rust-lang/rust/pull/119984#discussion_r1452856806>.

Test files in `tests/` are normally ignored by `x fmt`, but sometimes those files end up being run through `rustfmt` anyway, either by `rust-analyzer` or by hand.

When that happens, it's annoying to have to manually revert formatting changes that are unrelated to the actual changes being made. So it's helpful for the tests in the repository to already have standard formatting beforehand.

However, there are several coverage tests that deliberately use non-standard formatting, so that line counts reveal more information about where code regions begin and end. In those cases, we can use `#[rustfmt::skip]` to prevent that code from being disturbed.

``@rustbot`` label +A-code-coverage
2024-01-21 06:38:37 +01:00
..
auxiliary coverage: Regression test for #117788 2023-11-13 12:31:44 +11:00
abort.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
abort.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
abort.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
assert_not.cov-map coverage: Regression test for assert!(!false) 2023-12-16 20:58:04 +11:00
assert_not.coverage coverage: Regression test for assert!(!false) 2023-12-16 20:58:04 +11:00
assert_not.rs coverage: Regression test for assert!(!false) 2023-12-16 20:58:04 +11:00
assert.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
assert.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
assert.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
async2.cov-map Enable GVN by default. 2023-12-24 20:08:57 +00:00
async2.coverage Remove unnecessary lets and borrowing from Waker::noop() usage. 2024-01-17 12:00:27 -08:00
async2.rs Remove unnecessary lets and borrowing from Waker::noop() usage. 2024-01-17 12:00:27 -08:00
async_block.cov-map coverage: Add a test for async blocks 2023-12-20 18:48:04 +11:00
async_block.coverage Remove unnecessary lets and borrowing from Waker::noop() usage. 2024-01-17 12:00:27 -08:00
async_block.rs Remove unnecessary lets and borrowing from Waker::noop() usage. 2024-01-17 12:00:27 -08:00
async.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
async.coverage Rollup merge of #120015 - Zalathar:format, r=dtolnay 2024-01-21 06:38:37 +01:00
async.rs Rollup merge of #120015 - Zalathar:format, r=dtolnay 2024-01-21 06:38:37 +01:00
bad_counter_ids.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
bad_counter_ids.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
bad_counter_ids.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
closure_bug.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
closure_bug.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
closure_bug.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
closure_macro_async.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
closure_macro_async.coverage Rollup merge of #120015 - Zalathar:format, r=dtolnay 2024-01-21 06:38:37 +01:00
closure_macro_async.rs Rollup merge of #120015 - Zalathar:format, r=dtolnay 2024-01-21 06:38:37 +01:00
closure_macro.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
closure_macro.coverage coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
closure_macro.rs coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
closure.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
closure.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
closure.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
color.coverage Allow coverage tests to enable llvm-cov --use-color 2024-01-05 13:42:54 +11:00
color.rs Allow coverage tests to enable llvm-cov --use-color 2024-01-05 13:42:54 +11:00
conditions.cov-map coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
conditions.coverage coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
conditions.rs coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
continue.cov-map coverage: Simplify building coverage expressions based on sums 2023-11-25 12:29:20 +11:00
continue.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
continue.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
coroutine.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
coroutine.coverage coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
coroutine.rs coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
dead_code.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
dead_code.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
dead_code.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
drop_trait.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
drop_trait.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
drop_trait.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
fn_sig_into_try.cov-map coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
fn_sig_into_try.coverage coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
fn_sig_into_try.rs coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
generics.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
generics.coverage coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
generics.rs coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
if_else.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if_else.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if_else.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if_not.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if_not.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if_not.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
if.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
ignore_map.coverage Allow tests to ignore individual test modes 2024-01-05 13:42:54 +11:00
ignore_map.rs Allow tests to ignore individual test modes 2024-01-05 13:42:54 +11:00
ignore_run.cov-map Allow tests to ignore individual test modes 2024-01-05 13:42:54 +11:00
ignore_run.rs Allow tests to ignore individual test modes 2024-01-05 13:42:54 +11:00
inline-dead.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
inline-dead.coverage coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
inline-dead.rs coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
inline.cov-map coverage: Skip spans that can't be un-expanded back to the function body 2023-12-03 12:35:33 +11:00
inline.coverage coverage: Skip spans that can't be un-expanded back to the function body 2023-12-03 12:35:33 +11:00
inline.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
inner_items.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
inner_items.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
inner_items.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
issue-83601.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
issue-83601.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
issue-83601.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
issue-84561.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
issue-84561.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
issue-84561.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
issue-85461.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
issue-85461.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
issue-85461.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
issue-93054.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
issue-93054.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
issue-93054.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
lazy_boolean.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
lazy_boolean.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
lazy_boolean.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
long_and_wide.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
long_and_wide.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
long_and_wide.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
loop_break_value.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
loop_break_value.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
loop_break_value.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
loops_branches.cov-map coverage: Simplify building coverage expressions based on sums 2023-11-25 12:29:20 +11:00
loops_branches.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
loops_branches.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
macro_name_span.cov-map macro_rules: Less hacky heuristic for using tt metavariable spans 2024-01-04 03:53:56 +03:00
macro_name_span.coverage macro_rules: Less hacky heuristic for using tt metavariable spans 2024-01-04 03:53:56 +03:00
macro_name_span.rs coverage: Regression test for #117788 2023-11-13 12:31:44 +11:00
match_or_pattern.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
match_or_pattern.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
match_or_pattern.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
nested_loops.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
nested_loops.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
nested_loops.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
no_cov_crate.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
no_cov_crate.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
no_cov_crate.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
no_spans_if_not.cov-map coverage: Regression test for markers in a function with no spans 2023-12-16 11:10:11 +11:00
no_spans_if_not.coverage coverage: Regression test for markers in a function with no spans 2023-12-16 11:10:11 +11:00
no_spans_if_not.rs coverage: Regression test for markers in a function with no spans 2023-12-16 11:10:11 +11:00
no_spans.cov-map coverage: Regression test for unwrapping prev when there are no spans 2023-12-08 22:49:12 +11:00
no_spans.coverage coverage: Regression test for unwrapping prev when there are no spans 2023-12-08 22:49:12 +11:00
no_spans.rs coverage: Regression test for unwrapping prev when there are no spans 2023-12-08 22:49:12 +11:00
overflow.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
overflow.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
overflow.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
panic_unwind.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
panic_unwind.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
panic_unwind.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
partial_eq.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
partial_eq.coverage coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
partial_eq.rs coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
README.md coverage: Rename the run-coverage test mode to coverage-run 2023-11-08 16:41:24 +11:00
simple_loop.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
simple_loop.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
simple_loop.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
simple_match.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
simple_match.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
simple_match.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
sort_groups.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
sort_groups.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
sort_groups.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
test_harness.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
test_harness.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
test_harness.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
thin-lto.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
thin-lto.coverage coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
thin-lto.rs coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
tight_inf_loop.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
tight_inf_loop.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
tight_inf_loop.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
trivial.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
trivial.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
trivial.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
try_error_result.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
try_error_result.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
try_error_result.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
unicode.cov-map coverage: llvm-cov expects column numbers to be bytes, not code points 2024-01-08 21:58:46 +11:00
unicode.coverage coverage: llvm-cov expects column numbers to be bytes, not code points 2024-01-08 21:58:46 +11:00
unicode.rs coverage: llvm-cov expects column numbers to be bytes, not code points 2024-01-08 21:58:46 +11:00
unreachable.cov-map coverage: Skip spans that can't be un-expanded back to the function body 2023-12-03 12:35:33 +11:00
unreachable.coverage coverage: Skip spans that can't be un-expanded back to the function body 2023-12-03 12:35:33 +11:00
unreachable.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
unused_mod.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
unused_mod.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
unused_mod.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
unused.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
unused.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
unused.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
uses_crate.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
uses_crate.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
uses_crate.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
uses_inline_crate.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
uses_inline_crate.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
uses_inline_crate.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
while_early_ret.cov-map coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
while_early_ret.coverage coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
while_early_ret.rs coverage: Add #[rustfmt::skip] to tests with non-standard formatting 2024-01-16 15:56:37 +11:00
while.cov-map coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
while.coverage coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
while.rs coverage: Tweak individual tests to be unaffected by rustfmt 2024-01-16 16:14:27 +11:00
yield.cov-map coverage: Migrate tests/coverage-map into tests/coverage 2023-11-07 11:15:19 +11:00
yield.coverage coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00
yield.rs coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00

The tests in this directory are shared by two different test modes, and can be run in multiple different ways:

  • ./x.py test coverage-map (compiles to LLVM IR and checks coverage mappings)
  • ./x.py test coverage-run (runs a test binary and checks its coverage report)
  • ./x.py test coverage (runs both coverage-map and coverage-run)

Maintenance note

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

If you haven't touched the coverage code directly, and the tests still pass in coverage-run mode, then it should usually be OK to just re-bless the mappings as necessary with ./x.py test coverage-map --bless, without worrying too much about the exact changes.