summary refs log tree commit diff
path: root/tests/coverage-map
AgeCommit message (Collapse)AuthorLines
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.