rust/tests/coverage
Jonathan Conder 25d183057e coverage: Treat await similar to a macro
Currently `await` is only counted towards coverage if the containing
function is suspended and resumed at least once. This is because it
expands to code which contains a branch on the discriminant of `Poll`.

By treating it like a branching macro (e.g. `assert!`), these
implementation details will be hidden from the coverage results.
2024-09-06 17:01:59 +12:00
..
attr coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
auxiliary Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
branch coverage: Add debugging flag -Zcoverage-options=no-mir-spans 2024-06-17 21:16:15 +10:00
condition coverage: Instrument the RHS value of lazy logical operators 2024-05-30 15:38:46 +10:00
mcdc Finish blessing coverage/mcdc tests after LLVM 19 upgrade 2024-08-01 13:36:50 +10:00
abort.cov-map Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
abort.coverage Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
abort.rs Remove c_unwind from tests and fix tests 2024-06-19 13:54:55 +01:00
assert_not.cov-map
assert_not.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
assert_not.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
assert-ne.cov-map coverage: Add tests/coverage/assert-ne.rs 2024-06-12 22:38:16 +10:00
assert-ne.coverage coverage: Add tests/coverage/assert-ne.rs 2024-06-12 22:38:16 +10:00
assert-ne.rs coverage: Add tests/coverage/assert-ne.rs 2024-06-12 22:38:16 +10:00
assert.cov-map
assert.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
assert.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
async2.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
async2.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
async2.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
async_block.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
async_block.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
async_block.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
async.cov-map coverage: Treat await similar to a macro 2024-09-06 17:01:59 +12:00
async.coverage coverage: Treat await similar to a macro 2024-09-06 17:01:59 +12:00
async.rs coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
await_ready.cov-map coverage: Treat await similar to a macro 2024-09-06 17:01:59 +12:00
await_ready.coverage coverage: Treat await similar to a macro 2024-09-06 17:01:59 +12:00
await_ready.rs coverage: Treat await similar to a macro 2024-09-06 17:01:59 +12:00
bad_counter_ids.cov-map coverage: Use normal edition: headers in coverage tests 2024-02-02 11:17:05 +11:00
bad_counter_ids.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
bad_counter_ids.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
bench.cov-map Add #[coverage(off)] to closures introduced by #[test]/#[bench] 2024-01-21 23:17:00 +11:00
bench.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
bench.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure_bug.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
closure_bug.coverage
closure_bug.rs
closure_macro_async.cov-map coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
closure_macro_async.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure_macro_async.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure_macro.cov-map coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
closure_macro.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure_macro.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure_unit_return.cov-map coverage: Discard spans that fill the entire function body 2024-02-16 10:57:03 +11:00
closure_unit_return.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure_unit_return.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure.cov-map Bless coverage. 2024-07-13 12:02:12 +00:00
closure.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
closure.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
color.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
color.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
conditions.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
conditions.coverage
conditions.rs
continue.cov-map
continue.coverage
continue.rs
coroutine.cov-map Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
coroutine.coverage Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
coroutine.rs Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
coverage_attr_closure.cov-map coverage: Discard spans that fill the entire function body 2024-02-16 10:57:03 +11:00
coverage_attr_closure.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
coverage_attr_closure.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dead_code.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
dead_code.coverage
dead_code.rs
drop_trait.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
drop_trait.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
drop_trait.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
fn_sig_into_try.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
fn_sig_into_try.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
fn_sig_into_try.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
generics.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
generics.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
generics.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
holes.cov-map coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
holes.coverage coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
holes.rs coverage: Test for handling of nested item spans 2024-07-08 20:24:15 +10:00
if_else.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
if_else.coverage
if_else.rs
if_not.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
if_not.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
if_not.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
if.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
if.coverage
if.rs
ignore_map.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ignore_map.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
ignore_run.cov-map
ignore_run.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
inline-dead.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
inline-dead.coverage Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
inline-dead.rs Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
inline.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
inline.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
inline.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
inner_items.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
inner_items.coverage Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
inner_items.rs Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
issue-83601.cov-map update coverage test 2024-06-26 00:06:27 +02:00
issue-83601.coverage coverage: Don't instrument #[automatically_derived] functions 2024-01-22 12:18:57 +11:00
issue-83601.rs
issue-84561.cov-map update coverage test 2024-06-26 00:06:27 +02:00
issue-84561.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-84561.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-85461.cov-map
issue-85461.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-85461.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-93054.cov-map coverage: Use normal edition: headers in coverage tests 2024-02-02 11:17:05 +11:00
issue-93054.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
issue-93054.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
lazy_boolean.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
lazy_boolean.coverage
lazy_boolean.rs
let_else_loop.cov-map Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
let_else_loop.coverage Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
let_else_loop.rs Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
long_and_wide.cov-map
long_and_wide.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
long_and_wide.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
loop_break_value.cov-map
loop_break_value.coverage
loop_break_value.rs
loop-break.cov-map coverage: Replace the old span refiner with a single function 2024-06-12 22:59:24 +10:00
loop-break.coverage coverage: Replace the old span refiner with a single function 2024-06-12 22:59:24 +10:00
loop-break.rs coverage: Add tests/coverage/loop-break.rs 2024-06-12 22:48:11 +10:00
loops_branches.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
loops_branches.coverage
loops_branches.rs
macro_in_closure.cov-map coverage: Test for closure body that is a single bang-macro 2024-02-05 10:07:18 +11:00
macro_in_closure.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
macro_in_closure.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
macro_name_span.cov-map coverage: Discard spans that fill the entire function body 2024-02-16 10:57:03 +11:00
macro_name_span.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
macro_name_span.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
match_or_pattern.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
match_or_pattern.coverage
match_or_pattern.rs
nested_loops.cov-map
nested_loops.coverage
nested_loops.rs
no_cov_crate.cov-map coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
no_cov_crate.coverage coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
no_cov_crate.rs
no_spans_if_not.cov-map macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
no_spans_if_not.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
no_spans_if_not.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
no_spans.cov-map macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
no_spans.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
no_spans.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
overflow.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
overflow.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
overflow.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
panic_unwind.cov-map
panic_unwind.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
panic_unwind.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
partial_eq.cov-map Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
partial_eq.coverage Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
partial_eq.rs Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
README.md
simple_loop.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
simple_loop.coverage
simple_loop.rs
simple_match.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
simple_match.coverage
simple_match.rs
sort_groups.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
sort_groups.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
sort_groups.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
test_harness.cov-map Add #[coverage(off)] to closures introduced by #[test]/#[bench] 2024-01-21 23:17:00 +11:00
test_harness.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
test_harness.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
thin-lto.cov-map coverage: Format all remaining tests 2024-01-18 10:42:37 +11:00
thin-lto.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
thin-lto.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
tight_inf_loop.cov-map
tight_inf_loop.coverage
tight_inf_loop.rs
trivial.cov-map
trivial.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
trivial.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
try_error_result.cov-map Create mapped places upon seeing them in the body. 2024-07-13 11:54:25 +00:00
try_error_result.coverage Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
try_error_result.rs Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
unicode.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
unicode.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unicode.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unreachable.cov-map Eliminate UbCheck for non-standard libraries 2024-03-27 21:02:40 +08:00
unreachable.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unreachable.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
unused_mod.cov-map
unused_mod.coverage
unused_mod.rs
unused.cov-map
unused.coverage
unused.rs
uses_crate.cov-map
uses_crate.coverage Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
uses_crate.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
uses_inline_crate.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
uses_inline_crate.coverage Tweak various coverage test files for slightly nicer formatting 2024-05-29 14:34:11 +10:00
uses_inline_crate.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
while_early_ret.cov-map
while_early_ret.coverage [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
while_early_ret.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
while.cov-map coverage: Simplify counter expressions using simple algebra 2024-05-14 13:58:40 +10:00
while.coverage
while.rs
yield.cov-map Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
yield.coverage Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10:00
yield.rs Manually run x fmt on all source files in tests/coverage/ 2024-05-29 14:34:17 +10: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.