diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2025-08-06 22:02:01 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2025-08-06 22:38:52 +1000 |
| commit | 81ed042c8cc4a1bd677c9209cf9edca6b91af04a (patch) | |
| tree | 9f2916faf332a32de4cf12582698de10ee8600ee /tests/coverage/mcdc | |
| parent | dc0bae1db725fbba8524f195f74f680995fd549e (diff) | |
| download | rust-81ed042c8cc4a1bd677c9209cf9edca6b91af04a.tar.gz rust-81ed042c8cc4a1bd677c9209cf9edca6b91af04a.zip | |
coverage: Remove all unstable support for MC/DC instrumentation
Diffstat (limited to 'tests/coverage/mcdc')
| -rw-r--r-- | tests/coverage/mcdc/condition-limit.cov-map | 58 | ||||
| -rw-r--r-- | tests/coverage/mcdc/condition-limit.coverage | 55 | ||||
| -rw-r--r-- | tests/coverage/mcdc/condition-limit.rs | 17 | ||||
| -rw-r--r-- | tests/coverage/mcdc/if.cov-map | 223 | ||||
| -rw-r--r-- | tests/coverage/mcdc/if.coverage | 287 | ||||
| -rw-r--r-- | tests/coverage/mcdc/if.rs | 102 | ||||
| -rw-r--r-- | tests/coverage/mcdc/inlined_expressions.cov-map | 21 | ||||
| -rw-r--r-- | tests/coverage/mcdc/inlined_expressions.coverage | 40 | ||||
| -rw-r--r-- | tests/coverage/mcdc/inlined_expressions.rs | 16 | ||||
| -rw-r--r-- | tests/coverage/mcdc/nested_if.cov-map | 200 | ||||
| -rw-r--r-- | tests/coverage/mcdc/nested_if.coverage | 257 | ||||
| -rw-r--r-- | tests/coverage/mcdc/nested_if.rs | 69 | ||||
| -rw-r--r-- | tests/coverage/mcdc/non_control_flow.cov-map | 186 | ||||
| -rw-r--r-- | tests/coverage/mcdc/non_control_flow.coverage | 224 | ||||
| -rw-r--r-- | tests/coverage/mcdc/non_control_flow.rs | 71 |
15 files changed, 0 insertions, 1826 deletions
diff --git a/tests/coverage/mcdc/condition-limit.cov-map b/tests/coverage/mcdc/condition-limit.cov-map deleted file mode 100644 index ffee97cfbc5..00000000000 --- a/tests/coverage/mcdc/condition-limit.cov-map +++ /dev/null @@ -1,58 +0,0 @@ -Function name: condition_limit::accept_7_conditions -Raw bytes (192): 0x[01, 01, 08, 01, 05, 05, 09, 09, 0d, 0d, 11, 11, 15, 15, 19, 19, 1d, 01, 1d, 1b, 01, 06, 01, 00, 2c, 01, 01, 0a, 00, 0b, 01, 00, 0d, 00, 0e, 01, 00, 10, 00, 11, 01, 00, 13, 00, 14, 01, 00, 16, 00, 17, 01, 00, 19, 00, 1a, 01, 00, 1c, 00, 1d, 01, 00, 21, 00, 29, 01, 01, 08, 00, 09, 28, 08, 07, 00, 08, 00, 27, 30, 05, 02, 01, 07, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 07, 06, 00, 00, 0d, 00, 0e, 09, 00, 12, 00, 13, 30, 0d, 0a, 06, 05, 00, 00, 12, 00, 13, 0d, 00, 17, 00, 18, 30, 11, 0e, 05, 04, 00, 00, 17, 00, 18, 11, 00, 1c, 00, 1d, 30, 15, 12, 04, 03, 00, 00, 1c, 00, 1d, 15, 00, 21, 00, 22, 30, 19, 16, 03, 02, 00, 00, 21, 00, 22, 19, 00, 26, 00, 27, 30, 1d, 1a, 02, 00, 00, 00, 26, 00, 27, 1d, 00, 28, 02, 06, 1e, 02, 05, 00, 06, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/condition-limit.rs -Number of expressions: 8 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(2), rhs = Counter(3) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) -- expression 4 operands: lhs = Counter(4), rhs = Counter(5) -- expression 5 operands: lhs = Counter(5), rhs = Counter(6) -- expression 6 operands: lhs = Counter(6), rhs = Counter(7) -- expression 7 operands: lhs = Counter(0), rhs = Counter(7) -Number of file 0 mappings: 27 -- Code(Counter(0)) at (prev + 6, 1) to (start + 0, 44) -- Code(Counter(0)) at (prev + 1, 10) to (start + 0, 11) -- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 16) to (start + 0, 17) -- Code(Counter(0)) at (prev + 0, 19) to (start + 0, 20) -- Code(Counter(0)) at (prev + 0, 22) to (start + 0, 23) -- Code(Counter(0)) at (prev + 0, 25) to (start + 0, 26) -- Code(Counter(0)) at (prev + 0, 28) to (start + 0, 29) -- Code(Counter(0)) at (prev + 0, 33) to (start + 0, 41) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 8, conditions_num: 7 } at (prev + 0, 8) to (start + 0, 39) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 7, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 7, true_next_id: 6, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 6, true_next_id: 5, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = c3 - false = (c2 - c3) -- Code(Counter(3)) at (prev + 0, 23) to (start + 0, 24) -- MCDCBranch { true: Counter(4), false: Expression(3, Sub), condition_id: 5, true_next_id: 4, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) - true = c4 - false = (c3 - c4) -- Code(Counter(4)) at (prev + 0, 28) to (start + 0, 29) -- MCDCBranch { true: Counter(5), false: Expression(4, Sub), condition_id: 4, true_next_id: 3, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) - true = c5 - false = (c4 - c5) -- Code(Counter(5)) at (prev + 0, 33) to (start + 0, 34) -- MCDCBranch { true: Counter(6), false: Expression(5, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) - true = c6 - false = (c5 - c6) -- Code(Counter(6)) at (prev + 0, 38) to (start + 0, 39) -- MCDCBranch { true: Counter(7), false: Expression(6, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 38) to (start + 0, 39) - true = c7 - false = (c6 - c7) -- Code(Counter(7)) at (prev + 0, 40) to (start + 2, 6) -- Code(Expression(7, Sub)) at (prev + 2, 5) to (start + 0, 6) - = (c0 - c7) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c7 - diff --git a/tests/coverage/mcdc/condition-limit.coverage b/tests/coverage/mcdc/condition-limit.coverage deleted file mode 100644 index 04ccd6497c3..00000000000 --- a/tests/coverage/mcdc/condition-limit.coverage +++ /dev/null @@ -1,55 +0,0 @@ - LL| |#![feature(coverage_attribute)] - LL| |//@ edition: 2021 - LL| |//@ compile-flags: -Zcoverage-options=mcdc - LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc - LL| | - LL| 2|fn accept_7_conditions(bool_arr: [bool; 7]) { - LL| 2| let [a, b, c, d, e, f, g] = bool_arr; - LL| 2| if a && b && c && d && e && f && g { - ^1 ^1 ^1 ^1 ^1 ^1 - ------------------ - | Branch (LL:8): [True: 1, False: 1] - | Branch (LL:13): [True: 1, False: 0] - | Branch (LL:18): [True: 1, False: 0] - | Branch (LL:23): [True: 1, False: 0] - | Branch (LL:28): [True: 1, False: 0] - | Branch (LL:33): [True: 1, False: 0] - | Branch (LL:38): [True: 1, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:39) - | - | Number of Conditions: 7 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | Condition C3 --> (LL:18) - | Condition C4 --> (LL:23) - | Condition C5 --> (LL:28) - | Condition C6 --> (LL:33) - | Condition C7 --> (LL:38) - | - | Executed MC/DC Test Vectors: - | - | C1, C2, C3, C4, C5, C6, C7 Result - | 1 { F, -, -, -, -, -, - = F } - | 2 { T, T, T, T, T, T, T = T } - | - | C1-Pair: covered: (1,2) - | C2-Pair: not covered - | C3-Pair: not covered - | C4-Pair: not covered - | C5-Pair: not covered - | C6-Pair: not covered - | C7-Pair: not covered - | MC/DC Coverage for Decision: 14.29% - | - ------------------ - LL| 1| core::hint::black_box("hello"); - LL| 1| } - LL| 2|} - LL| | - LL| |#[coverage(off)] - LL| |fn main() { - LL| | accept_7_conditions([false; 7]); - LL| | accept_7_conditions([true; 7]); - LL| |} - diff --git a/tests/coverage/mcdc/condition-limit.rs b/tests/coverage/mcdc/condition-limit.rs deleted file mode 100644 index 867636cdaed..00000000000 --- a/tests/coverage/mcdc/condition-limit.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=mcdc -//@ llvm-cov-flags: --show-branches=count --show-mcdc - -fn accept_7_conditions(bool_arr: [bool; 7]) { - let [a, b, c, d, e, f, g] = bool_arr; - if a && b && c && d && e && f && g { - core::hint::black_box("hello"); - } -} - -#[coverage(off)] -fn main() { - accept_7_conditions([false; 7]); - accept_7_conditions([true; 7]); -} diff --git a/tests/coverage/mcdc/if.cov-map b/tests/coverage/mcdc/if.cov-map deleted file mode 100644 index dac1eb4c94b..00000000000 --- a/tests/coverage/mcdc/if.cov-map +++ /dev/null @@ -1,223 +0,0 @@ -Function name: if::mcdc_check_a -Raw bytes (67): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 09, 01, 0e, 01, 00, 22, 01, 01, 08, 00, 09, 28, 03, 02, 00, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 3 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -Number of file 0 mappings: 9 -- Code(Counter(0)) at (prev + 14, 1) to (start + 0, 34) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 14) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c2) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: if::mcdc_check_b -Raw bytes (67): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 09, 01, 16, 01, 00, 22, 01, 01, 08, 00, 09, 28, 03, 02, 00, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 3 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -Number of file 0 mappings: 9 -- Code(Counter(0)) at (prev + 22, 1) to (start + 0, 34) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 14) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c2) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: if::mcdc_check_both -Raw bytes (67): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 09, 01, 1e, 01, 00, 25, 01, 01, 08, 00, 09, 28, 03, 02, 00, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 3 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -Number of file 0 mappings: 9 -- Code(Counter(0)) at (prev + 30, 1) to (start + 0, 37) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 14) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c2) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: if::mcdc_check_neither -Raw bytes (67): 0x[01, 01, 03, 01, 05, 05, 09, 01, 09, 09, 01, 06, 01, 00, 28, 01, 01, 08, 00, 09, 28, 03, 02, 00, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 09, 06, 02, 00, 00, 00, 0d, 00, 0e, 09, 00, 0f, 02, 06, 0a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 3 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -Number of file 0 mappings: 9 -- Code(Counter(0)) at (prev + 6, 1) to (start + 0, 40) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 14) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 15) to (start + 2, 6) -- Code(Expression(2, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c2) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: if::mcdc_check_not_tree_decision -Raw bytes (90): 0x[01, 01, 07, 01, 05, 01, 17, 05, 09, 05, 09, 17, 0d, 05, 09, 01, 0d, 0b, 01, 30, 01, 00, 3b, 28, 05, 03, 03, 08, 00, 15, 01, 00, 09, 00, 0a, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 06, 03, 02, 00, 00, 0e, 00, 0f, 17, 00, 14, 00, 15, 30, 0d, 12, 02, 00, 00, 00, 14, 00, 15, 0d, 00, 16, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 7 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(5, Add) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Expression(5, Add), rhs = Counter(3) -- expression 5 operands: lhs = Counter(1), rhs = Counter(2) -- expression 6 operands: lhs = Counter(0), rhs = Counter(3) -Number of file 0 mappings: 11 -- Code(Counter(0)) at (prev + 48, 1) to (start + 0, 59) -- MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21) -- Code(Counter(0)) at (prev + 0, 9) to (start + 0, 10) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 3 } at (prev + 0, 9) to (start + 0, 10) - true = c1 - false = (c0 - c1) -- Code(Expression(0, Sub)) at (prev + 0, 14) to (start + 0, 15) - = (c0 - c1) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) - true = c2 - false = (c0 - (c1 + c2)) -- Code(Expression(5, Add)) at (prev + 0, 20) to (start + 0, 21) - = (c1 + c2) -- MCDCBranch { true: Counter(3), false: Expression(4, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21) - true = c3 - false = ((c1 + c2) - c3) -- Code(Counter(3)) at (prev + 0, 22) to (start + 2, 6) -- Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c3) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c3 - -Function name: if::mcdc_check_tree_decision -Raw bytes (92): 0x[01, 01, 08, 01, 05, 05, 09, 05, 09, 05, 1f, 09, 0d, 09, 0d, 01, 1f, 09, 0d, 0b, 01, 26, 01, 00, 37, 01, 03, 08, 00, 09, 28, 04, 03, 00, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 09, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 0d, 0e, 03, 00, 00, 00, 13, 00, 14, 1f, 00, 16, 02, 06, 1a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 8 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(7, Add) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -- expression 5 operands: lhs = Counter(2), rhs = Counter(3) -- expression 6 operands: lhs = Counter(0), rhs = Expression(7, Add) -- expression 7 operands: lhs = Counter(2), rhs = Counter(3) -Number of file 0 mappings: 11 -- Code(Counter(0)) at (prev + 38, 1) to (start + 0, 55) -- Code(Counter(0)) at (prev + 3, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 0, 8) to (start + 0, 21) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15) -- MCDCBranch { true: Counter(2), false: Expression(2, Sub), condition_id: 2, true_next_id: 0, false_next_id: 3 } at (prev + 0, 14) to (start + 0, 15) - true = c2 - false = (c1 - c2) -- Code(Expression(2, Sub)) at (prev + 0, 19) to (start + 0, 20) - = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) - true = c3 - false = (c1 - (c2 + c3)) -- Code(Expression(7, Add)) at (prev + 0, 22) to (start + 2, 6) - = (c2 + c3) -- Code(Expression(6, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - (c2 + c3)) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c3 - -Function name: if::mcdc_nested_if -Raw bytes (139): 0x[01, 01, 0d, 01, 05, 01, 33, 05, 09, 05, 09, 05, 09, 05, 09, 33, 0d, 05, 09, 0d, 11, 33, 11, 05, 09, 01, 33, 05, 09, 11, 01, 3a, 01, 00, 2d, 01, 01, 08, 00, 09, 28, 03, 02, 00, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 2e, 02, 00, 00, 00, 0d, 00, 0e, 33, 01, 09, 00, 0c, 33, 00, 0d, 00, 15, 33, 01, 0c, 00, 0d, 28, 06, 02, 00, 0c, 00, 12, 30, 0d, 1a, 01, 02, 00, 00, 0c, 00, 0d, 0d, 00, 11, 00, 12, 30, 11, 22, 02, 00, 00, 00, 11, 00, 12, 11, 00, 13, 02, 0a, 26, 02, 09, 00, 0a, 2e, 01, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/if.rs -Number of expressions: 13 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(12, Add) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(1), rhs = Counter(2) -- expression 5 operands: lhs = Counter(1), rhs = Counter(2) -- expression 6 operands: lhs = Expression(12, Add), rhs = Counter(3) -- expression 7 operands: lhs = Counter(1), rhs = Counter(2) -- expression 8 operands: lhs = Counter(3), rhs = Counter(4) -- expression 9 operands: lhs = Expression(12, Add), rhs = Counter(4) -- expression 10 operands: lhs = Counter(1), rhs = Counter(2) -- expression 11 operands: lhs = Counter(0), rhs = Expression(12, Add) -- expression 12 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 17 -- Code(Counter(0)) at (prev + 58, 1) to (start + 0, 45) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 14) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 14) - = (c0 - c1) -- MCDCBranch { true: Counter(2), false: Expression(11, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c2 - false = (c0 - (c1 + c2)) -- Code(Expression(12, Add)) at (prev + 1, 9) to (start + 0, 12) - = (c1 + c2) -- Code(Expression(12, Add)) at (prev + 0, 13) to (start + 0, 21) - = (c1 + c2) -- Code(Expression(12, Add)) at (prev + 1, 12) to (start + 0, 13) - = (c1 + c2) -- MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 12) to (start + 0, 18) -- MCDCBranch { true: Counter(3), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13) - true = c3 - false = ((c1 + c2) - c3) -- Code(Counter(3)) at (prev + 0, 17) to (start + 0, 18) -- MCDCBranch { true: Counter(4), false: Expression(8, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18) - true = c4 - false = (c3 - c4) -- Code(Counter(4)) at (prev + 0, 19) to (start + 2, 10) -- Code(Expression(9, Sub)) at (prev + 2, 9) to (start + 0, 10) - = ((c1 + c2) - c4) -- Code(Expression(11, Sub)) at (prev + 1, 12) to (start + 2, 6) - = (c0 - (c1 + c2)) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c4 - diff --git a/tests/coverage/mcdc/if.coverage b/tests/coverage/mcdc/if.coverage deleted file mode 100644 index fda5525c472..00000000000 --- a/tests/coverage/mcdc/if.coverage +++ /dev/null @@ -1,287 +0,0 @@ - LL| |#![feature(coverage_attribute)] - LL| |//@ edition: 2021 - LL| |//@ compile-flags: -Zcoverage-options=mcdc - LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc - LL| | - LL| 2|fn mcdc_check_neither(a: bool, b: bool) { - LL| 2| if a && b { - ^0 - ------------------ - | Branch (LL:8): [True: 0, False: 2] - | Branch (LL:13): [True: 0, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:14) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | - | C1-Pair: not covered - | C2-Pair: not covered - | MC/DC Coverage for Decision: 0.00% - | - ------------------ - LL| 0| say("a and b"); - LL| 2| } else { - LL| 2| say("not both"); - LL| 2| } - LL| 2|} - LL| | - LL| 2|fn mcdc_check_a(a: bool, b: bool) { - LL| 2| if a && b { - ^1 - ------------------ - | Branch (LL:8): [True: 1, False: 1] - | Branch (LL:13): [True: 1, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:14) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, T = T } - | - | C1-Pair: covered: (1,2) - | C2-Pair: not covered - | MC/DC Coverage for Decision: 50.00% - | - ------------------ - LL| 1| say("a and b"); - LL| 1| } else { - LL| 1| say("not both"); - LL| 1| } - LL| 2|} - LL| | - LL| 2|fn mcdc_check_b(a: bool, b: bool) { - LL| 2| if a && b { - ------------------ - | Branch (LL:8): [True: 2, False: 0] - | Branch (LL:13): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:14) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { T, F = F } - | 2 { T, T = T } - | - | C1-Pair: not covered - | C2-Pair: covered: (1,2) - | MC/DC Coverage for Decision: 50.00% - | - ------------------ - LL| 1| say("a and b"); - LL| 1| } else { - LL| 1| say("not both"); - LL| 1| } - LL| 2|} - LL| | - LL| 3|fn mcdc_check_both(a: bool, b: bool) { - LL| 3| if a && b { - ^2 - ------------------ - | Branch (LL:8): [True: 2, False: 1] - | Branch (LL:13): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:14) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 1| say("a and b"); - LL| 2| } else { - LL| 2| say("not both"); - LL| 2| } - LL| 3|} - LL| | - LL| 4|fn mcdc_check_tree_decision(a: bool, b: bool, c: bool) { - LL| | // This expression is intentionally written in a way - LL| | // where 100% branch coverage indicates 100% mcdc coverage. - LL| 4| if a && (b || c) { - ^3 ^2 - ------------------ - | Branch (LL:8): [True: 3, False: 1] - | Branch (LL:14): [True: 1, False: 2] - | Branch (LL:19): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:21) - | - | Number of Conditions: 3 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:14) - | Condition C3 --> (LL:19) - | - | Executed MC/DC Test Vectors: - | - | C1, C2, C3 Result - | 1 { F, -, - = F } - | 2 { T, F, F = F } - | 3 { T, F, T = T } - | 4 { T, T, - = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,4) - | C3-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 2| say("pass"); - LL| 2| } else { - LL| 2| say("reject"); - LL| 2| } - LL| 4|} - LL| | - LL| 4|fn mcdc_check_not_tree_decision(a: bool, b: bool, c: bool) { - LL| | // Contradict to `mcdc_check_tree_decision`, - LL| | // 100% branch coverage of this expression does not indicate 100% mcdc coverage. - LL| 4| if (a || b) && c { - ^1 - ------------------ - | Branch (LL:9): [True: 3, False: 1] - | Branch (LL:14): [True: 1, False: 0] - | Branch (LL:20): [True: 2, False: 2] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:21) - | - | Number of Conditions: 3 - | Condition C1 --> (LL:9) - | Condition C2 --> (LL:14) - | Condition C3 --> (LL:20) - | - | Executed MC/DC Test Vectors: - | - | C1, C2, C3 Result - | 1 { T, -, F = F } - | 2 { F, T, T = T } - | 3 { T, -, T = T } - | - | C1-Pair: not covered - | C2-Pair: not covered - | C3-Pair: covered: (1,3) - | MC/DC Coverage for Decision: 33.33% - | - ------------------ - LL| 2| say("pass"); - LL| 2| } else { - LL| 2| say("reject"); - LL| 2| } - LL| 4|} - LL| | - LL| 3|fn mcdc_nested_if(a: bool, b: bool, c: bool) { - LL| 3| if a || b { - ^0 - ------------------ - | Branch (LL:8): [True: 3, False: 0] - | Branch (LL:13): [True: 0, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:14) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { T, - = T } - | - | C1-Pair: not covered - | C2-Pair: not covered - | MC/DC Coverage for Decision: 0.00% - | - ------------------ - LL| 3| say("a or b"); - LL| 3| if b && c { - ^2 - ------------------ - | Branch (LL:12): [True: 2, False: 1] - | Branch (LL:17): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:12) to (LL:18) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:12) - | Condition C2 --> (LL:17) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 1| say("b and c"); - LL| 2| } - LL| 0| } else { - LL| 0| say("neither a nor b"); - LL| 0| } - LL| 3|} - LL| | - LL| |#[coverage(off)] - LL| |fn main() { - LL| | mcdc_check_neither(false, false); - LL| | mcdc_check_neither(false, true); - LL| | - LL| | mcdc_check_a(true, true); - LL| | mcdc_check_a(false, true); - LL| | - LL| | mcdc_check_b(true, true); - LL| | mcdc_check_b(true, false); - LL| | - LL| | mcdc_check_both(false, true); - LL| | mcdc_check_both(true, true); - LL| | mcdc_check_both(true, false); - LL| | - LL| | mcdc_check_tree_decision(false, true, true); - LL| | mcdc_check_tree_decision(true, true, false); - LL| | mcdc_check_tree_decision(true, false, false); - LL| | mcdc_check_tree_decision(true, false, true); - LL| | - LL| | mcdc_check_not_tree_decision(false, true, true); - LL| | mcdc_check_not_tree_decision(true, true, false); - LL| | mcdc_check_not_tree_decision(true, false, false); - LL| | mcdc_check_not_tree_decision(true, false, true); - LL| | - LL| | mcdc_nested_if(true, false, true); - LL| | mcdc_nested_if(true, true, true); - LL| | mcdc_nested_if(true, true, false); - LL| |} - LL| | - LL| |#[coverage(off)] - LL| |fn say(message: &str) { - LL| | core::hint::black_box(message); - LL| |} - diff --git a/tests/coverage/mcdc/if.rs b/tests/coverage/mcdc/if.rs deleted file mode 100644 index c4675f5d167..00000000000 --- a/tests/coverage/mcdc/if.rs +++ /dev/null @@ -1,102 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=mcdc -//@ llvm-cov-flags: --show-branches=count --show-mcdc - -fn mcdc_check_neither(a: bool, b: bool) { - if a && b { - say("a and b"); - } else { - say("not both"); - } -} - -fn mcdc_check_a(a: bool, b: bool) { - if a && b { - say("a and b"); - } else { - say("not both"); - } -} - -fn mcdc_check_b(a: bool, b: bool) { - if a && b { - say("a and b"); - } else { - say("not both"); - } -} - -fn mcdc_check_both(a: bool, b: bool) { - if a && b { - say("a and b"); - } else { - say("not both"); - } -} - -fn mcdc_check_tree_decision(a: bool, b: bool, c: bool) { - // This expression is intentionally written in a way - // where 100% branch coverage indicates 100% mcdc coverage. - if a && (b || c) { - say("pass"); - } else { - say("reject"); - } -} - -fn mcdc_check_not_tree_decision(a: bool, b: bool, c: bool) { - // Contradict to `mcdc_check_tree_decision`, - // 100% branch coverage of this expression does not indicate 100% mcdc coverage. - if (a || b) && c { - say("pass"); - } else { - say("reject"); - } -} - -fn mcdc_nested_if(a: bool, b: bool, c: bool) { - if a || b { - say("a or b"); - if b && c { - say("b and c"); - } - } else { - say("neither a nor b"); - } -} - -#[coverage(off)] -fn main() { - mcdc_check_neither(false, false); - mcdc_check_neither(false, true); - - mcdc_check_a(true, true); - mcdc_check_a(false, true); - - mcdc_check_b(true, true); - mcdc_check_b(true, false); - - mcdc_check_both(false, true); - mcdc_check_both(true, true); - mcdc_check_both(true, false); - - mcdc_check_tree_decision(false, true, true); - mcdc_check_tree_decision(true, true, false); - mcdc_check_tree_decision(true, false, false); - mcdc_check_tree_decision(true, false, true); - - mcdc_check_not_tree_decision(false, true, true); - mcdc_check_not_tree_decision(true, true, false); - mcdc_check_not_tree_decision(true, false, false); - mcdc_check_not_tree_decision(true, false, true); - - mcdc_nested_if(true, false, true); - mcdc_nested_if(true, true, true); - mcdc_nested_if(true, true, false); -} - -#[coverage(off)] -fn say(message: &str) { - core::hint::black_box(message); -} diff --git a/tests/coverage/mcdc/inlined_expressions.cov-map b/tests/coverage/mcdc/inlined_expressions.cov-map deleted file mode 100644 index d05ef368ba4..00000000000 --- a/tests/coverage/mcdc/inlined_expressions.cov-map +++ /dev/null @@ -1,21 +0,0 @@ -Function name: inlined_expressions::inlined_instance -Raw bytes (55): 0x[01, 01, 02, 01, 05, 05, 09, 07, 01, 07, 01, 00, 2e, 01, 01, 05, 00, 06, 28, 03, 02, 00, 05, 00, 0b, 30, 05, 02, 01, 02, 00, 00, 05, 00, 06, 05, 00, 0a, 00, 0b, 30, 09, 06, 02, 00, 00, 00, 0a, 00, 0b, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/inlined_expressions.rs -Number of expressions: 2 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 7 -- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 46) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 5) to (start + 0, 11) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 5) to (start + 0, 6) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 10) to (start + 0, 11) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 10) to (start + 0, 11) - true = c2 - false = (c1 - c2) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c2 - diff --git a/tests/coverage/mcdc/inlined_expressions.coverage b/tests/coverage/mcdc/inlined_expressions.coverage deleted file mode 100644 index cfe398995e4..00000000000 --- a/tests/coverage/mcdc/inlined_expressions.coverage +++ /dev/null @@ -1,40 +0,0 @@ - LL| |#![feature(coverage_attribute)] - LL| |//@ edition: 2021 - LL| |//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0 - LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc - LL| | - LL| |#[inline(always)] - LL| 3|fn inlined_instance(a: bool, b: bool) -> bool { - LL| 3| a && b - ^2 - ------------------ - | Branch (LL:5): [True: 2, False: 1] - | Branch (LL:10): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:5) to (LL:11) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:5) - | Condition C2 --> (LL:10) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 3|} - LL| | - LL| |#[coverage(off)] - LL| |fn main() { - LL| | let _ = inlined_instance(true, false); - LL| | let _ = inlined_instance(false, true); - LL| | let _ = inlined_instance(true, true); - LL| |} - diff --git a/tests/coverage/mcdc/inlined_expressions.rs b/tests/coverage/mcdc/inlined_expressions.rs deleted file mode 100644 index 15d4260f6e2..00000000000 --- a/tests/coverage/mcdc/inlined_expressions.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0 -//@ llvm-cov-flags: --show-branches=count --show-mcdc - -#[inline(always)] -fn inlined_instance(a: bool, b: bool) -> bool { - a && b -} - -#[coverage(off)] -fn main() { - let _ = inlined_instance(true, false); - let _ = inlined_instance(false, true); - let _ = inlined_instance(true, true); -} diff --git a/tests/coverage/mcdc/nested_if.cov-map b/tests/coverage/mcdc/nested_if.cov-map deleted file mode 100644 index 853cdf2c576..00000000000 --- a/tests/coverage/mcdc/nested_if.cov-map +++ /dev/null @@ -1,200 +0,0 @@ -Function name: nested_if::doubly_nested_if_in_condition -Raw bytes (175): 0x[01, 01, 0f, 01, 05, 05, 11, 05, 09, 05, 37, 09, 0d, 05, 09, 05, 1f, 09, 15, 15, 19, 05, 2b, 09, 19, 09, 0d, 05, 37, 09, 0d, 01, 11, 15, 01, 0e, 01, 00, 45, 01, 01, 08, 00, 09, 28, 09, 02, 00, 08, 00, 4e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 06, 02, 00, 00, 00, 0d, 00, 4e, 05, 00, 10, 00, 11, 28, 06, 02, 00, 10, 00, 36, 30, 09, 16, 01, 00, 02, 00, 10, 00, 11, 30, 0d, 32, 02, 00, 00, 00, 15, 00, 36, 16, 00, 18, 00, 19, 28, 03, 02, 00, 18, 00, 1e, 30, 15, 1a, 01, 02, 00, 00, 18, 00, 19, 15, 00, 1d, 00, 1e, 30, 19, 22, 02, 00, 00, 00, 1d, 00, 1e, 19, 00, 21, 00, 25, 26, 00, 2f, 00, 34, 37, 00, 39, 00, 3e, 32, 00, 48, 00, 4c, 11, 00, 4f, 02, 06, 3a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/nested_if.rs -Number of expressions: 15 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(4) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Expression(13, Add) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -- expression 5 operands: lhs = Counter(1), rhs = Counter(2) -- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add) -- expression 7 operands: lhs = Counter(2), rhs = Counter(5) -- expression 8 operands: lhs = Counter(5), rhs = Counter(6) -- expression 9 operands: lhs = Counter(1), rhs = Expression(10, Add) -- expression 10 operands: lhs = Counter(2), rhs = Counter(6) -- expression 11 operands: lhs = Counter(2), rhs = Counter(3) -- expression 12 operands: lhs = Counter(1), rhs = Expression(13, Add) -- expression 13 operands: lhs = Counter(2), rhs = Counter(3) -- expression 14 operands: lhs = Counter(0), rhs = Counter(4) -Number of file 0 mappings: 21 -- Code(Counter(0)) at (prev + 14, 1) to (start + 0, 69) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 78) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- MCDCBranch { true: Counter(4), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 78) - true = c4 - false = (c1 - c4) -- Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17) -- MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 16) to (start + 0, 54) -- MCDCBranch { true: Counter(2), false: Expression(5, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17) - true = c2 - false = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Expression(12, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 54) - true = c3 - false = (c1 - (c2 + c3)) -- Code(Expression(5, Sub)) at (prev + 0, 24) to (start + 0, 25) - = (c1 - c2) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 24) to (start + 0, 30) -- MCDCBranch { true: Counter(5), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 24) to (start + 0, 25) - true = c5 - false = (c1 - (c2 + c5)) -- Code(Counter(5)) at (prev + 0, 29) to (start + 0, 30) -- MCDCBranch { true: Counter(6), false: Expression(8, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 29) to (start + 0, 30) - true = c6 - false = (c5 - c6) -- Code(Counter(6)) at (prev + 0, 33) to (start + 0, 37) -- Code(Expression(9, Sub)) at (prev + 0, 47) to (start + 0, 52) - = (c1 - (c2 + c6)) -- Code(Expression(13, Add)) at (prev + 0, 57) to (start + 0, 62) - = (c2 + c3) -- Code(Expression(12, Sub)) at (prev + 0, 72) to (start + 0, 76) - = (c1 - (c2 + c3)) -- Code(Counter(4)) at (prev + 0, 79) to (start + 2, 6) -- Code(Expression(14, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c4) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c6 - -Function name: nested_if::nested_if_in_condition -Raw bytes (123): 0x[01, 01, 0a, 01, 05, 05, 11, 05, 09, 05, 09, 05, 23, 09, 0d, 09, 0d, 05, 23, 09, 0d, 01, 11, 0f, 01, 06, 01, 00, 35, 01, 01, 08, 00, 09, 28, 06, 02, 00, 08, 00, 2e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 11, 06, 02, 00, 00, 00, 0d, 00, 2e, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0e, 01, 00, 02, 00, 10, 00, 11, 0e, 00, 15, 00, 16, 30, 0d, 1e, 02, 00, 00, 00, 15, 00, 16, 23, 00, 19, 00, 1d, 1e, 00, 27, 00, 2c, 11, 00, 2f, 02, 06, 26, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/nested_if.rs -Number of expressions: 10 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(4) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(1), rhs = Expression(8, Add) -- expression 5 operands: lhs = Counter(2), rhs = Counter(3) -- expression 6 operands: lhs = Counter(2), rhs = Counter(3) -- expression 7 operands: lhs = Counter(1), rhs = Expression(8, Add) -- expression 8 operands: lhs = Counter(2), rhs = Counter(3) -- expression 9 operands: lhs = Counter(0), rhs = Counter(4) -Number of file 0 mappings: 15 -- Code(Counter(0)) at (prev + 6, 1) to (start + 0, 53) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 46) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- MCDCBranch { true: Counter(4), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 46) - true = c4 - false = (c1 - c4) -- Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 16) to (start + 0, 22) -- MCDCBranch { true: Counter(2), false: Expression(3, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17) - true = c2 - false = (c1 - c2) -- Code(Expression(3, Sub)) at (prev + 0, 21) to (start + 0, 22) - = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Expression(7, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22) - true = c3 - false = (c1 - (c2 + c3)) -- Code(Expression(8, Add)) at (prev + 0, 25) to (start + 0, 29) - = (c2 + c3) -- Code(Expression(7, Sub)) at (prev + 0, 39) to (start + 0, 44) - = (c1 - (c2 + c3)) -- Code(Counter(4)) at (prev + 0, 47) to (start + 2, 6) -- Code(Expression(9, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c4) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c4 - -Function name: nested_if::nested_in_then_block_in_condition -Raw bytes (175): 0x[01, 01, 0f, 01, 05, 05, 19, 05, 09, 05, 09, 05, 37, 09, 0d, 09, 0d, 37, 11, 09, 0d, 11, 15, 37, 15, 09, 0d, 05, 37, 09, 0d, 01, 19, 15, 01, 21, 01, 00, 52, 01, 01, 08, 00, 09, 28, 09, 02, 00, 08, 00, 4b, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 19, 06, 02, 00, 00, 00, 0d, 00, 4b, 05, 00, 10, 00, 11, 28, 03, 02, 00, 10, 00, 16, 30, 09, 0e, 01, 00, 02, 00, 10, 00, 11, 0e, 00, 15, 00, 16, 30, 0d, 32, 02, 00, 00, 00, 15, 00, 16, 37, 00, 1c, 00, 1d, 28, 06, 02, 00, 1c, 00, 22, 30, 11, 1e, 01, 02, 00, 00, 1c, 00, 1d, 11, 00, 21, 00, 22, 30, 15, 26, 02, 00, 00, 00, 21, 00, 22, 15, 00, 25, 00, 29, 2a, 00, 33, 00, 38, 32, 00, 44, 00, 49, 19, 00, 4c, 02, 06, 3a, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/nested_if.rs -Number of expressions: 15 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(6) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(1), rhs = Expression(13, Add) -- expression 5 operands: lhs = Counter(2), rhs = Counter(3) -- expression 6 operands: lhs = Counter(2), rhs = Counter(3) -- expression 7 operands: lhs = Expression(13, Add), rhs = Counter(4) -- expression 8 operands: lhs = Counter(2), rhs = Counter(3) -- expression 9 operands: lhs = Counter(4), rhs = Counter(5) -- expression 10 operands: lhs = Expression(13, Add), rhs = Counter(5) -- expression 11 operands: lhs = Counter(2), rhs = Counter(3) -- expression 12 operands: lhs = Counter(1), rhs = Expression(13, Add) -- expression 13 operands: lhs = Counter(2), rhs = Counter(3) -- expression 14 operands: lhs = Counter(0), rhs = Counter(6) -Number of file 0 mappings: 21 -- Code(Counter(0)) at (prev + 33, 1) to (start + 0, 82) -- Code(Counter(0)) at (prev + 1, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 9, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 75) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- MCDCBranch { true: Counter(6), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 75) - true = c6 - false = (c1 - c6) -- Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 16) to (start + 0, 22) -- MCDCBranch { true: Counter(2), false: Expression(3, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 16) to (start + 0, 17) - true = c2 - false = (c1 - c2) -- Code(Expression(3, Sub)) at (prev + 0, 21) to (start + 0, 22) - = (c1 - c2) -- MCDCBranch { true: Counter(3), false: Expression(12, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 21) to (start + 0, 22) - true = c3 - false = (c1 - (c2 + c3)) -- Code(Expression(13, Add)) at (prev + 0, 28) to (start + 0, 29) - = (c2 + c3) -- MCDCDecision { bitmap_idx: 6, conditions_num: 2 } at (prev + 0, 28) to (start + 0, 34) -- MCDCBranch { true: Counter(4), false: Expression(7, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 28) to (start + 0, 29) - true = c4 - false = ((c2 + c3) - c4) -- Code(Counter(4)) at (prev + 0, 33) to (start + 0, 34) -- MCDCBranch { true: Counter(5), false: Expression(9, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 33) to (start + 0, 34) - true = c5 - false = (c4 - c5) -- Code(Counter(5)) at (prev + 0, 37) to (start + 0, 41) -- Code(Expression(10, Sub)) at (prev + 0, 51) to (start + 0, 56) - = ((c2 + c3) - c5) -- Code(Expression(12, Sub)) at (prev + 0, 68) to (start + 0, 73) - = (c1 - (c2 + c3)) -- Code(Counter(6)) at (prev + 0, 76) to (start + 2, 6) -- Code(Expression(14, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c6) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c6 - -Function name: nested_if::nested_single_condition_decision -Raw bytes (88): 0x[01, 01, 05, 01, 05, 05, 0d, 05, 09, 05, 09, 01, 0d, 0c, 01, 16, 01, 00, 36, 01, 04, 08, 00, 09, 28, 03, 02, 00, 08, 00, 29, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 30, 0d, 06, 02, 00, 00, 00, 0d, 00, 29, 05, 00, 10, 00, 11, 20, 09, 0e, 00, 10, 00, 11, 09, 00, 14, 00, 19, 0e, 00, 23, 00, 27, 0d, 00, 2a, 02, 06, 12, 02, 0c, 02, 06, 01, 03, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/nested_if.rs -Number of expressions: 5 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(3) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(1), rhs = Counter(2) -- expression 4 operands: lhs = Counter(0), rhs = Counter(3) -Number of file 0 mappings: 12 -- Code(Counter(0)) at (prev + 22, 1) to (start + 0, 54) -- Code(Counter(0)) at (prev + 4, 8) to (start + 0, 9) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 8) to (start + 0, 41) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9) - true = c1 - false = (c0 - c1) -- MCDCBranch { true: Counter(3), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 41) - true = c3 - false = (c1 - c3) -- Code(Counter(1)) at (prev + 0, 16) to (start + 0, 17) -- Branch { true: Counter(2), false: Expression(3, Sub) } at (prev + 0, 16) to (start + 0, 17) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 20) to (start + 0, 25) -- Code(Expression(3, Sub)) at (prev + 0, 35) to (start + 0, 39) - = (c1 - c2) -- Code(Counter(3)) at (prev + 0, 42) to (start + 2, 6) -- Code(Expression(4, Sub)) at (prev + 2, 12) to (start + 2, 6) - = (c0 - c3) -- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c3 - diff --git a/tests/coverage/mcdc/nested_if.coverage b/tests/coverage/mcdc/nested_if.coverage deleted file mode 100644 index 8b5179b34fe..00000000000 --- a/tests/coverage/mcdc/nested_if.coverage +++ /dev/null @@ -1,257 +0,0 @@ - LL| |#![feature(coverage_attribute)] - LL| |//@ edition: 2021 - LL| |//@ compile-flags: -Zcoverage-options=mcdc - LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc - LL| | - LL| 4|fn nested_if_in_condition(a: bool, b: bool, c: bool) { - LL| 4| if a && if b || c { true } else { false } { - ^3 ^2 ^2 ^1 - ------------------ - | Branch (LL:8): [True: 3, False: 1] - | Branch (LL:13): [True: 2, False: 1] - | Branch (LL:16): [True: 1, False: 2] - | Branch (LL:21): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:46) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - |---> MC/DC Decision Region (LL:16) to (LL:22) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:16) - | Condition C2 --> (LL:21) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, F = F } - | 2 { F, T = T } - | 3 { T, - = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (1,2) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 2| say("yes"); - LL| 2| } else { - LL| 2| say("no"); - LL| 2| } - LL| 4|} - LL| | - LL| 4|fn doubly_nested_if_in_condition(a: bool, b: bool, c: bool, d: bool) { - LL| 4| if a && if b || if c && d { true } else { false } { false } else { true } { - ^3 ^2 ^1 ^1 ^1 ^2 ^1 - ------------------ - | Branch (LL:8): [True: 3, False: 1] - | Branch (LL:13): [True: 1, False: 2] - | Branch (LL:16): [True: 1, False: 2] - | Branch (LL:21): [True: 1, False: 1] - | Branch (LL:24): [True: 1, False: 1] - | Branch (LL:29): [True: 1, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:78) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - |---> MC/DC Decision Region (LL:16) to (LL:54) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:16) - | Condition C2 --> (LL:21) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, F = F } - | 2 { F, T = T } - | 3 { T, - = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (1,2) - | MC/DC Coverage for Decision: 100.00% - | - |---> MC/DC Decision Region (LL:24) to (LL:30) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:24) - | Condition C2 --> (LL:29) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, T = T } - | - | C1-Pair: covered: (1,2) - | C2-Pair: not covered - | MC/DC Coverage for Decision: 50.00% - | - ------------------ - LL| 1| say("yes"); - LL| 3| } else { - LL| 3| say("no"); - LL| 3| } - LL| 4|} - LL| | - LL| 3|fn nested_single_condition_decision(a: bool, b: bool) { - LL| | // Decision with only 1 decision should not be instrumented by MCDC because - LL| | // branch-coverage is equivalent to MCDC coverage in this case, and we don't - LL| | // want to waste bitmap space for this. - LL| 3| if a && if b { false } else { true } { - ^2 ^1 ^1 - ------------------ - | Branch (LL:8): [True: 2, False: 1] - | Branch (LL:13): [True: 1, False: 1] - | Branch (LL:16): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:41) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 1| say("yes"); - LL| 2| } else { - LL| 2| say("no"); - LL| 2| } - LL| 3|} - LL| | - LL| 7|fn nested_in_then_block_in_condition(a: bool, b: bool, c: bool, d: bool, e: bool) { - LL| 7| if a && if b || c { if d && e { true } else { false } } else { false } { - ^6 ^5 ^5 ^2 ^1 ^4 ^1 - ------------------ - | Branch (LL:8): [True: 6, False: 1] - | Branch (LL:13): [True: 1, False: 5] - | Branch (LL:16): [True: 1, False: 5] - | Branch (LL:21): [True: 4, False: 1] - | Branch (LL:28): [True: 2, False: 3] - | Branch (LL:33): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:8) to (LL:75) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:8) - | Condition C2 --> (LL:13) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - |---> MC/DC Decision Region (LL:16) to (LL:22) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:16) - | Condition C2 --> (LL:21) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, F = F } - | 2 { F, T = T } - | 3 { T, - = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (1,2) - | MC/DC Coverage for Decision: 100.00% - | - |---> MC/DC Decision Region (LL:28) to (LL:34) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:28) - | Condition C2 --> (LL:33) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 1| say("yes"); - LL| 6| } else { - LL| 6| say("no"); - LL| 6| } - LL| 7|} - LL| | - LL| |#[coverage(off)] - LL| |fn main() { - LL| | nested_if_in_condition(true, false, false); - LL| | nested_if_in_condition(true, true, true); - LL| | nested_if_in_condition(true, false, true); - LL| | nested_if_in_condition(false, true, true); - LL| | - LL| | doubly_nested_if_in_condition(true, false, false, true); - LL| | doubly_nested_if_in_condition(true, true, true, true); - LL| | doubly_nested_if_in_condition(true, false, true, true); - LL| | doubly_nested_if_in_condition(false, true, true, true); - LL| | - LL| | nested_single_condition_decision(true, true); - LL| | nested_single_condition_decision(true, false); - LL| | nested_single_condition_decision(false, false); - LL| | - LL| | nested_in_then_block_in_condition(false, false, false, false, false); - LL| | nested_in_then_block_in_condition(true, false, false, false, false); - LL| | nested_in_then_block_in_condition(true, true, false, false, false); - LL| | nested_in_then_block_in_condition(true, false, true, false, false); - LL| | nested_in_then_block_in_condition(true, false, true, true, false); - LL| | nested_in_then_block_in_condition(true, false, true, false, true); - LL| | nested_in_then_block_in_condition(true, false, true, true, true); - LL| |} - LL| | - LL| |#[coverage(off)] - LL| |fn say(message: &str) { - LL| | core::hint::black_box(message); - LL| |} - diff --git a/tests/coverage/mcdc/nested_if.rs b/tests/coverage/mcdc/nested_if.rs deleted file mode 100644 index db02aece33c..00000000000 --- a/tests/coverage/mcdc/nested_if.rs +++ /dev/null @@ -1,69 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=mcdc -//@ llvm-cov-flags: --show-branches=count --show-mcdc - -fn nested_if_in_condition(a: bool, b: bool, c: bool) { - if a && if b || c { true } else { false } { - say("yes"); - } else { - say("no"); - } -} - -fn doubly_nested_if_in_condition(a: bool, b: bool, c: bool, d: bool) { - if a && if b || if c && d { true } else { false } { false } else { true } { - say("yes"); - } else { - say("no"); - } -} - -fn nested_single_condition_decision(a: bool, b: bool) { - // Decision with only 1 decision should not be instrumented by MCDC because - // branch-coverage is equivalent to MCDC coverage in this case, and we don't - // want to waste bitmap space for this. - if a && if b { false } else { true } { - say("yes"); - } else { - say("no"); - } -} - -fn nested_in_then_block_in_condition(a: bool, b: bool, c: bool, d: bool, e: bool) { - if a && if b || c { if d && e { true } else { false } } else { false } { - say("yes"); - } else { - say("no"); - } -} - -#[coverage(off)] -fn main() { - nested_if_in_condition(true, false, false); - nested_if_in_condition(true, true, true); - nested_if_in_condition(true, false, true); - nested_if_in_condition(false, true, true); - - doubly_nested_if_in_condition(true, false, false, true); - doubly_nested_if_in_condition(true, true, true, true); - doubly_nested_if_in_condition(true, false, true, true); - doubly_nested_if_in_condition(false, true, true, true); - - nested_single_condition_decision(true, true); - nested_single_condition_decision(true, false); - nested_single_condition_decision(false, false); - - nested_in_then_block_in_condition(false, false, false, false, false); - nested_in_then_block_in_condition(true, false, false, false, false); - nested_in_then_block_in_condition(true, true, false, false, false); - nested_in_then_block_in_condition(true, false, true, false, false); - nested_in_then_block_in_condition(true, false, true, true, false); - nested_in_then_block_in_condition(true, false, true, false, true); - nested_in_then_block_in_condition(true, false, true, true, true); -} - -#[coverage(off)] -fn say(message: &str) { - core::hint::black_box(message); -} diff --git a/tests/coverage/mcdc/non_control_flow.cov-map b/tests/coverage/mcdc/non_control_flow.cov-map deleted file mode 100644 index f06bc2ed816..00000000000 --- a/tests/coverage/mcdc/non_control_flow.cov-map +++ /dev/null @@ -1,186 +0,0 @@ -Function name: non_control_flow::assign_3 -Raw bytes (89): 0x[01, 01, 04, 01, 05, 01, 0b, 05, 09, 09, 0d, 0c, 01, 15, 01, 00, 27, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 04, 03, 00, 0d, 00, 18, 30, 05, 02, 01, 00, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 30, 09, 06, 02, 03, 00, 00, 12, 00, 13, 09, 00, 17, 00, 18, 30, 0d, 0e, 03, 00, 00, 00, 17, 00, 18, 01, 01, 05, 00, 0e, 01, 00, 0f, 00, 10, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 4 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -- expression 3 operands: lhs = Counter(2), rhs = Counter(3) -Number of file 0 mappings: 12 -- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 39) -- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- MCDCDecision { bitmap_idx: 4, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) - true = c1 - false = (c0 - c1) -- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) - = (c0 - c1) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = c2 - false = (c0 - (c1 + c2)) -- Code(Counter(2)) at (prev + 0, 23) to (start + 0, 24) -- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) - true = c3 - false = (c2 - c3) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 15) to (start + 0, 16) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c3 - -Function name: non_control_flow::assign_3_bis -Raw bytes (91): 0x[01, 01, 05, 01, 05, 05, 09, 01, 09, 01, 13, 09, 0d, 0c, 01, 1a, 01, 00, 2b, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 05, 03, 00, 0d, 00, 18, 30, 05, 02, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 06, 03, 00, 02, 00, 12, 00, 13, 0a, 00, 17, 00, 18, 30, 0d, 0e, 02, 00, 00, 00, 17, 00, 18, 01, 01, 05, 00, 0e, 01, 00, 0f, 00, 10, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 5 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(0), rhs = Counter(2) -- expression 3 operands: lhs = Counter(0), rhs = Expression(4, Add) -- expression 4 operands: lhs = Counter(2), rhs = Counter(3) -Number of file 0 mappings: 12 -- Code(Counter(0)) at (prev + 26, 1) to (start + 0, 43) -- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- MCDCDecision { bitmap_idx: 5, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19) - true = c2 - false = (c1 - c2) -- Code(Expression(2, Sub)) at (prev + 0, 23) to (start + 0, 24) - = (c0 - c2) -- MCDCBranch { true: Counter(3), false: Expression(3, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24) - true = c3 - false = (c0 - (c2 + c3)) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 15) to (start + 0, 16) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c3 - -Function name: non_control_flow::assign_and -Raw bytes (70): 0x[01, 01, 02, 01, 05, 05, 09, 0a, 01, 0b, 01, 00, 20, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 02, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 06, 02, 00, 00, 00, 12, 00, 13, 01, 01, 05, 00, 0e, 01, 00, 0f, 00, 10, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 2 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 10 -- Code(Counter(0)) at (prev + 11, 1) to (start + 0, 32) -- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = c2 - false = (c1 - c2) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 15) to (start + 0, 16) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: non_control_flow::assign_or -Raw bytes (72): 0x[01, 01, 03, 01, 05, 01, 0b, 05, 09, 0a, 01, 10, 01, 00, 1f, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 03, 02, 00, 0d, 00, 13, 30, 05, 02, 01, 00, 02, 00, 0d, 00, 0e, 02, 00, 12, 00, 13, 30, 09, 06, 02, 00, 00, 00, 12, 00, 13, 01, 01, 05, 00, 0e, 01, 00, 0f, 00, 10, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 3 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(0), rhs = Expression(2, Add) -- expression 2 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 10 -- Code(Counter(0)) at (prev + 16, 1) to (start + 0, 31) -- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14) - true = c1 - false = (c0 - c1) -- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19) - = (c0 - c1) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19) - true = c2 - false = (c0 - (c1 + c2)) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 15) to (start + 0, 16) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: non_control_flow::foo -Raw bytes (24): 0x[01, 01, 00, 04, 01, 24, 01, 00, 18, 01, 01, 05, 00, 0e, 01, 00, 0f, 00, 10, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 0 -Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 36, 1) to (start + 0, 24) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 15) to (start + 0, 16) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c0 - -Function name: non_control_flow::func_call -Raw bytes (60): 0x[01, 01, 02, 01, 05, 05, 09, 08, 01, 28, 01, 00, 1f, 01, 01, 05, 00, 08, 01, 00, 09, 00, 0a, 28, 03, 02, 00, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 06, 02, 00, 00, 00, 0e, 00, 0f, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 2 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 8 -- Code(Counter(0)) at (prev + 40, 1) to (start + 0, 31) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 8) -- Code(Counter(0)) at (prev + 0, 9) to (start + 0, 10) -- MCDCDecision { bitmap_idx: 3, conditions_num: 2 } at (prev + 0, 9) to (start + 0, 15) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 9) to (start + 0, 10) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15) - true = c2 - false = (c1 - c2) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c2 - -Function name: non_control_flow::right_comb_tree -Raw bytes (121): 0x[01, 01, 05, 01, 05, 05, 09, 09, 0d, 0d, 11, 11, 15, 10, 01, 1f, 01, 00, 40, 01, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 06, 05, 00, 0d, 00, 2a, 30, 05, 02, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 13, 00, 14, 30, 09, 06, 02, 03, 00, 00, 13, 00, 14, 09, 00, 19, 00, 1a, 30, 0d, 0a, 03, 04, 00, 00, 19, 00, 1a, 0d, 00, 1f, 00, 20, 30, 11, 0e, 04, 05, 00, 00, 1f, 00, 20, 11, 00, 24, 00, 27, 30, 15, 12, 05, 00, 00, 00, 24, 00, 27, 01, 01, 05, 00, 0e, 01, 00, 0f, 00, 10, 01, 01, 01, 00, 02] -Number of files: 1 -- file 0 => $DIR/non_control_flow.rs -Number of expressions: 5 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) -- expression 2 operands: lhs = Counter(2), rhs = Counter(3) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) -- expression 4 operands: lhs = Counter(4), rhs = Counter(5) -Number of file 0 mappings: 16 -- Code(Counter(0)) at (prev + 31, 1) to (start + 0, 64) -- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 10) -- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14) -- MCDCDecision { bitmap_idx: 6, conditions_num: 5 } at (prev + 0, 13) to (start + 0, 42) -- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14) - true = c1 - false = (c0 - c1) -- Code(Counter(1)) at (prev + 0, 19) to (start + 0, 20) -- MCDCBranch { true: Counter(2), false: Expression(1, Sub), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20) - true = c2 - false = (c1 - c2) -- Code(Counter(2)) at (prev + 0, 25) to (start + 0, 26) -- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 3, true_next_id: 4, false_next_id: 0 } at (prev + 0, 25) to (start + 0, 26) - true = c3 - false = (c2 - c3) -- Code(Counter(3)) at (prev + 0, 31) to (start + 0, 32) -- MCDCBranch { true: Counter(4), false: Expression(3, Sub), condition_id: 4, true_next_id: 5, false_next_id: 0 } at (prev + 0, 31) to (start + 0, 32) - true = c4 - false = (c3 - c4) -- Code(Counter(4)) at (prev + 0, 36) to (start + 0, 39) -- MCDCBranch { true: Counter(5), false: Expression(4, Sub), condition_id: 5, true_next_id: 0, false_next_id: 0 } at (prev + 0, 36) to (start + 0, 39) - true = c5 - false = (c4 - c5) -- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 14) -- Code(Counter(0)) at (prev + 0, 15) to (start + 0, 16) -- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c5 - diff --git a/tests/coverage/mcdc/non_control_flow.coverage b/tests/coverage/mcdc/non_control_flow.coverage deleted file mode 100644 index 419d40bb6f9..00000000000 --- a/tests/coverage/mcdc/non_control_flow.coverage +++ /dev/null @@ -1,224 +0,0 @@ - LL| |#![feature(coverage_attribute)] - LL| |//@ edition: 2021 - LL| |//@ compile-flags: -Zcoverage-options=mcdc - LL| |//@ llvm-cov-flags: --show-branches=count --show-mcdc - LL| | - LL| |// This test ensures that boolean expressions that are not inside control flow - LL| |// decisions are correctly instrumented. - LL| | - LL| |use core::hint::black_box; - LL| | - LL| 3|fn assign_and(a: bool, b: bool) { - LL| 3| let x = a && b; - ^2 - ------------------ - | Branch (LL:13): [True: 2, False: 1] - | Branch (LL:18): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:13) to (LL:19) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:13) - | Condition C2 --> (LL:18) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 3| black_box(x); - LL| 3|} - LL| | - LL| 3|fn assign_or(a: bool, b: bool) { - LL| 3| let x = a || b; - ^1 - ------------------ - | Branch (LL:13): [True: 2, False: 1] - | Branch (LL:18): [True: 0, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:13) to (LL:19) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:13) - | Condition C2 --> (LL:18) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, F = F } - | 2 { T, - = T } - | - | C1-Pair: covered: (1,2) - | C2-Pair: not covered - | MC/DC Coverage for Decision: 50.00% - | - ------------------ - LL| 3| black_box(x); - LL| 3|} - LL| | - LL| 4|fn assign_3(a: bool, b: bool, c: bool) { - LL| 4| let x = a || b && c; - ^2 ^1 - ------------------ - | Branch (LL:13): [True: 2, False: 2] - | Branch (LL:18): [True: 1, False: 1] - | Branch (LL:23): [True: 1, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:13) to (LL:24) - | - | Number of Conditions: 3 - | Condition C1 --> (LL:13) - | Condition C2 --> (LL:18) - | Condition C3 --> (LL:23) - | - | Executed MC/DC Test Vectors: - | - | C1, C2, C3 Result - | 1 { F, F, - = F } - | 2 { F, T, T = T } - | 3 { T, -, - = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (1,2) - | C3-Pair: not covered - | MC/DC Coverage for Decision: 66.67% - | - ------------------ - LL| 4| black_box(x); - LL| 4|} - LL| | - LL| 4|fn assign_3_bis(a: bool, b: bool, c: bool) { - LL| 4| let x = a && b || c; - ^2 ^3 - ------------------ - | Branch (LL:13): [True: 2, False: 2] - | Branch (LL:18): [True: 1, False: 1] - | Branch (LL:23): [True: 2, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:13) to (LL:24) - | - | Number of Conditions: 3 - | Condition C1 --> (LL:13) - | Condition C2 --> (LL:18) - | Condition C3 --> (LL:23) - | - | Executed MC/DC Test Vectors: - | - | C1, C2, C3 Result - | 1 { T, F, F = F } - | 2 { F, -, T = T } - | 3 { T, T, - = T } - | - | C1-Pair: not covered - | C2-Pair: covered: (1,3) - | C3-Pair: not covered - | MC/DC Coverage for Decision: 33.33% - | - ------------------ - LL| 4| black_box(x); - LL| 4|} - LL| | - LL| 3|fn right_comb_tree(a: bool, b: bool, c: bool, d: bool, e: bool) { - LL| 3| let x = a && (b && (c && (d && (e)))); - ^2 ^1 ^1 ^1 - ------------------ - | Branch (LL:13): [True: 2, False: 1] - | Branch (LL:19): [True: 1, False: 1] - | Branch (LL:25): [True: 1, False: 0] - | Branch (LL:31): [True: 1, False: 0] - | Branch (LL:36): [True: 1, False: 0] - ------------------ - |---> MC/DC Decision Region (LL:13) to (LL:42) - | - | Number of Conditions: 5 - | Condition C1 --> (LL:13) - | Condition C2 --> (LL:19) - | Condition C3 --> (LL:25) - | Condition C4 --> (LL:31) - | Condition C5 --> (LL:36) - | - | Executed MC/DC Test Vectors: - | - | C1, C2, C3, C4, C5 Result - | 1 { F, -, -, -, - = F } - | 2 { T, F, -, -, - = F } - | 3 { T, T, T, T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | C3-Pair: not covered - | C4-Pair: not covered - | C5-Pair: not covered - | MC/DC Coverage for Decision: 40.00% - | - ------------------ - LL| 3| black_box(x); - LL| 3|} - LL| | - LL| 3|fn foo(a: bool) -> bool { - LL| 3| black_box(a) - LL| 3|} - LL| | - LL| 3|fn func_call(a: bool, b: bool) { - LL| 3| foo(a && b); - ^2 - ------------------ - | Branch (LL:9): [True: 2, False: 1] - | Branch (LL:14): [True: 1, False: 1] - ------------------ - |---> MC/DC Decision Region (LL:9) to (LL:15) - | - | Number of Conditions: 2 - | Condition C1 --> (LL:9) - | Condition C2 --> (LL:14) - | - | Executed MC/DC Test Vectors: - | - | C1, C2 Result - | 1 { F, - = F } - | 2 { T, F = F } - | 3 { T, T = T } - | - | C1-Pair: covered: (1,3) - | C2-Pair: covered: (2,3) - | MC/DC Coverage for Decision: 100.00% - | - ------------------ - LL| 3|} - LL| | - LL| |#[coverage(off)] - LL| |fn main() { - LL| | assign_and(true, false); - LL| | assign_and(true, true); - LL| | assign_and(false, false); - LL| | - LL| | assign_or(true, false); - LL| | assign_or(true, true); - LL| | assign_or(false, false); - LL| | - LL| | assign_3(true, false, false); - LL| | assign_3(true, true, false); - LL| | assign_3(false, false, true); - LL| | assign_3(false, true, true); - LL| | - LL| | assign_3_bis(true, false, false); - LL| | assign_3_bis(true, true, false); - LL| | assign_3_bis(false, false, true); - LL| | assign_3_bis(false, true, true); - LL| | - LL| | right_comb_tree(false, false, false, true, true); - LL| | right_comb_tree(true, false, false, true, true); - LL| | right_comb_tree(true, true, true, true, true); - LL| | - LL| | func_call(true, false); - LL| | func_call(true, true); - LL| | func_call(false, false); - LL| |} - diff --git a/tests/coverage/mcdc/non_control_flow.rs b/tests/coverage/mcdc/non_control_flow.rs deleted file mode 100644 index 863bb8a5756..00000000000 --- a/tests/coverage/mcdc/non_control_flow.rs +++ /dev/null @@ -1,71 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=mcdc -//@ llvm-cov-flags: --show-branches=count --show-mcdc - -// This test ensures that boolean expressions that are not inside control flow -// decisions are correctly instrumented. - -use core::hint::black_box; - -fn assign_and(a: bool, b: bool) { - let x = a && b; - black_box(x); -} - -fn assign_or(a: bool, b: bool) { - let x = a || b; - black_box(x); -} - -fn assign_3(a: bool, b: bool, c: bool) { - let x = a || b && c; - black_box(x); -} - -fn assign_3_bis(a: bool, b: bool, c: bool) { - let x = a && b || c; - black_box(x); -} - -fn right_comb_tree(a: bool, b: bool, c: bool, d: bool, e: bool) { - let x = a && (b && (c && (d && (e)))); - black_box(x); -} - -fn foo(a: bool) -> bool { - black_box(a) -} - -fn func_call(a: bool, b: bool) { - foo(a && b); -} - -#[coverage(off)] -fn main() { - assign_and(true, false); - assign_and(true, true); - assign_and(false, false); - - assign_or(true, false); - assign_or(true, true); - assign_or(false, false); - - assign_3(true, false, false); - assign_3(true, true, false); - assign_3(false, false, true); - assign_3(false, true, true); - - assign_3_bis(true, false, false); - assign_3_bis(true, true, false); - assign_3_bis(false, false, true); - assign_3_bis(false, true, true); - - right_comb_tree(false, false, false, true, true); - right_comb_tree(true, false, false, true, true); - right_comb_tree(true, true, true, true, true); - - func_call(true, false); - func_call(true, true); - func_call(false, false); -} |
