rust/tests/coverage-map/status-quo/generator.cov-map
Zalathar 4690f97099 coverage: Fix an unstable-sort inconsistency in coverage spans
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-18 21:28:56 +10:00

59 lines
2.8 KiB
Plaintext

Function name: generator::get_u32
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 01, 01, 0b, 05, 01, 0e, 00, 13, 02, 00, 1d, 00, 3c, 07, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 11)
- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 19)
- Code(Expression(0, Sub)) at (prev + 0, 29) to (start + 0, 60)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
= (c1 + (c0 - c1))
Function name: generator::main
Raw bytes (71): 0x[01, 01, 0b, 01, 00, 05, 0b, 09, 0d, 11, 00, 11, 15, 2a, 19, 11, 15, 15, 19, 26, 00, 2a, 19, 11, 15, 09, 01, 0f, 01, 02, 16, 03, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 07, 01, 0e, 00, 35, 0f, 02, 0b, 00, 2e, 2a, 01, 22, 00, 27, 26, 00, 2c, 00, 2e, 1f, 01, 0e, 00, 35, 23, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 11
- expression 0 operands: lhs = Counter(0), rhs = Zero
- expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add)
- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
- expression 3 operands: lhs = Counter(4), rhs = Zero
- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
- expression 5 operands: lhs = Expression(10, Sub), rhs = Counter(6)
- expression 6 operands: lhs = Counter(4), rhs = Counter(5)
- expression 7 operands: lhs = Counter(5), rhs = Counter(6)
- expression 8 operands: lhs = Expression(9, Sub), rhs = Zero
- expression 9 operands: lhs = Expression(10, Sub), rhs = Counter(6)
- expression 10 operands: lhs = Counter(4), rhs = Counter(5)
Number of file 0 mappings: 9
- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 22)
- Code(Expression(0, Add)) at (prev + 7, 11) to (start + 0, 46)
= (c0 + Zero)
- Code(Counter(4)) at (prev + 1, 43) to (start + 0, 45)
- Code(Expression(1, Add)) at (prev + 1, 14) to (start + 0, 53)
= (c1 + (c2 + c3))
- Code(Expression(3, Add)) at (prev + 2, 11) to (start + 0, 46)
= (c4 + Zero)
- Code(Expression(10, Sub)) at (prev + 1, 34) to (start + 0, 39)
= (c4 - c5)
- Code(Expression(9, Sub)) at (prev + 0, 44) to (start + 0, 46)
= ((c4 - c5) - c6)
- Code(Expression(7, Add)) at (prev + 1, 14) to (start + 0, 53)
= (c5 + c6)
- Code(Expression(8, Add)) at (prev + 2, 1) to (start + 0, 2)
= (((c4 - c5) - c6) + Zero)
Function name: generator::main::{closure#0}
Raw bytes (14): 0x[01, 01, 00, 02, 01, 11, 1c, 01, 1f, 05, 02, 10, 01, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
- Code(Counter(0)) at (prev + 17, 28) to (start + 1, 31)
- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)