about summary refs log tree commit diff
path: root/tests/coverage-map
AgeCommit message (Collapse)AuthorLines
2023-11-07coverage: Migrate `tests/coverage-map` into `tests/coverage`Zalathar-6496/+0
2023-11-07coverage: Copy all remaining run-coverage tests into coverage-mapZalathar-0/+391
These multi-file tests were not copied over in #114843 because they weren't working, but it turns out that they just need the correct crate-type.
2023-11-07coverage: Flatten `coverage-map/status-quo/` into its parent directoryZalathar-1/+1
2023-11-07coverage: Remove `tests/coverage-map/if.rs`Zalathar-24/+0
There is another test named `if.rs` in `tests/coverage-map/status-quo/`, so this test stands in the way of flattening that directory into its parent. Fortunately both tests are more-or-less equivalent, so removing this one is fine.
2023-11-07coverage: Use `-Copt-level=2` by default in run-coverage testsZalathar-12/+28
This is a step towards being able to unify the two coverage test directories. There are two tests that require adjustment: - `overflow.rs` requires an explicit `-Coverflow-checks=yes` - `sort_groups.rs` is sensitive to provably unused instantiations
2023-10-28coverage: Consistently remove unused counter IDs from expressions/mappingsZalathar-143/+143
2023-10-28coverage: Regression test for #17012 (bad counter IDs in mappings)Zalathar-0/+164
2023-10-21coverage: Handle fn signature spans more consistently near `?`Zalathar-15/+17
2023-10-21coverage: Add a test showing the inconsistent handling of function signaturesZalathar-0/+94
2023-10-20Bless coverage mapOli Scherer-3/+3
2023-10-20Rename lots of files that had `generator` in their nameOli Scherer-0/+0
2023-10-20s/generator/coroutine/Oli Scherer-12/+12
2023-10-20s/Generator/Coroutine/Oli Scherer-8/+8
2023-10-18coverage: Store all of a function's mappings in function coverage infoZalathar-26/+8
Previously, mappings were attached to individual coverage statements in MIR. That necessitated special handling in MIR optimizations to avoid deleting those statements, since otherwise codegen would be unable to reassemble the original list of mappings. With this change, a function's list of mappings is now attached to its MIR body, and survives intact even if individual statements are deleted by optimizations.
2023-10-17Bless coverage-map testsBen Kimock-6/+23
2023-10-03coverage: Store each BCB's code regions in one coverage statementZalathar-948/+813
If a BCB has more than one code region, those extra regions can now all be stored in the same coverage statement, instead of being stored in additional statements.
2023-10-03coverage: Mappings for unused functions can all be zeroZalathar-62/+62
There is no need to include a dummy counter reference in the coverage mappings for an unused function.
2023-10-01coverage: Regression test for functions with unreachable bodiesZalathar-0/+61
2023-09-21coverage: Explicitly simplify coverage expressions in codegenZalathar-136/+128
After coverage instrumentation and MIR transformations, we can sometimes end up with coverage expressions that always have a value of zero. Any expression operand that refers to an always-zero expression can be replaced with a literal `Operand::Zero`, making the emitted coverage mapping data smaller and simpler. This simplification step is mostly redundant with the simplifications performed inline in `expressions_with_regions`, except that it does a slightly more thorough job in some cases (because it checks for always-zero expressions *after* other simplifications). However, adding this simplification step will then let us greatly simplify that code, without affecting the quality of the emitted coverage maps.
2023-09-18coverage: Regression test for inconsistent handling of closure spansZalathar-0/+192
2023-09-18coverage: Fix an unstable-sort inconsistency in coverage spansZalathar-9/+9
This code was calling `sort_unstable_by`, but failed to impose a total order on the initial spans. That resulted in unpredictable handling of closure spans, producing inconsistencies in the coverage maps and in user-visible coverage reports. This patch fixes the problem by always sorting closure spans before otherwise-identical non-closure spans, and also switches to a stable sort in case the ordering is still not total.
2023-09-08Fix up run-coverage and coverage-map/status-quo testsAndy Caldwell-15/+15
2023-09-05Copy most of `tests/run-coverage` into `tests/coverage-map/status-quo`Zalathar-0/+5527
The output of these tests is too complicated to comfortably verify by hand, but we can still use them to observe changes to the underlying mappings produced by codegen/LLVM. If these tests fail due to non-coverage changes (e.g. in HIR-to-MIR lowering or MIR optimizations), it should usually be OK to just `--bless` them, as long as the `run-coverage` test suite still works.
2023-09-05Add test suite `coverage-map` to test coverage mappings emitted by LLVMZalathar-0/+217
We compile each test file to LLVM IR assembly, and then pass that IR to a dedicated program that can decode LLVM coverage maps and print them in a more human-readable format. We can then check that output against known-good snapshots. This test suite has some advantages over the existing `run-coverage` tests: - We can test coverage instrumentation without needing to run target binaries. - We can observe subtle improvements/regressions in the underlying coverage mappings that don't make a visible difference to coverage reports.