about summary refs log tree commit diff
path: root/tests/coverage/mcdc/condition-limit.coverage
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-08 07:08:41 +0000
committerbors <bors@rust-lang.org>2024-10-08 07:08:41 +0000
commitcf24c73141a77db730f4b7fda69dcd7e8b113b51 (patch)
tree036b31c635fb5651cefd0f859046e5a174f8aef2 /tests/coverage/mcdc/condition-limit.coverage
parente6c46db4e9fd11e3183c397a59d946731034ede6 (diff)
parentacd64fa0d9e5c17de02a5b2a592163a377e33bcc (diff)
downloadrust-cf24c73141a77db730f4b7fda69dcd7e8b113b51.tar.gz
rust-cf24c73141a77db730f4b7fda69dcd7e8b113b51.zip
Auto merge of #126733 - ZhuUx:llvm-19-adapt, r=Zalathar
[Coverage][MCDC] Adapt mcdc to llvm 19

Related issue: #126672

Also finish task 4 at #124144

[llvm #82448](https://github.com/llvm/llvm-project/pull/82448) has introduced some break changes into mcdc, causing incompatibility between llvm 18 and 19. This draft adapts to that change and gives up supporting for llvm-18.
Diffstat (limited to 'tests/coverage/mcdc/condition-limit.coverage')
-rw-r--r--tests/coverage/mcdc/condition-limit.coverage70
1 files changed, 25 insertions, 45 deletions
diff --git a/tests/coverage/mcdc/condition-limit.coverage b/tests/coverage/mcdc/condition-limit.coverage
index ae8596bb961..d11b8a17710 100644
--- a/tests/coverage/mcdc/condition-limit.coverage
+++ b/tests/coverage/mcdc/condition-limit.coverage
@@ -1,76 +1,56 @@
    LL|       |#![feature(coverage_attribute)]
    LL|       |//@ edition: 2021
-   LL|       |//@ ignore-llvm-version: 19 - 99
+   LL|       |//@ min-llvm-version: 19
    LL|       |//@ compile-flags: -Zcoverage-options=mcdc
    LL|       |//@ llvm-cov-flags: --show-branches=count --show-mcdc
    LL|       |
-   LL|       |// Check that MC/DC instrumentation can gracefully handle conditions that
-   LL|       |// exceed LLVM's limit of 6 conditions per decision.
-   LL|       |//
-   LL|       |// (The limit is enforced in `compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs`.)
-   LL|       |
-   LL|      1|fn good() {
-   LL|      1|    // With only 6 conditions, perform full MC/DC instrumentation.
-   LL|      1|    let [a, b, c, d, e, f] = <[bool; 6]>::default();
-   LL|      1|    if a && b && c && d && e && f {
-                          ^0   ^0   ^0   ^0   ^0
+   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: 0, False: 1]
-  |  Branch (LL:13): [True: 0, False: 0]
-  |  Branch (LL:18): [True: 0, False: 0]
-  |  Branch (LL:23): [True: 0, False: 0]
-  |  Branch (LL:28): [True: 0, False: 0]
-  |  Branch (LL:33): [True: 0, False: 0]
+  |  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:34)
+  |---> MC/DC Decision Region (LL:8) to (LL:39)
   |
-  |  Number of Conditions: 6
+  |  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    Result
-  |  1 { F,  -,  -,  -,  -,  -  = F      }
+  |     C1, C2, C3, C4, C5, C6, C7    Result
+  |  1 { F,  -,  -,  -,  -,  -,  -  = F      }
+  |  2 { T,  T,  T,  T,  T,  T,  T  = T      }
   |
-  |  C1-Pair: not covered
+  |  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
-  |  MC/DC Coverage for Decision: 0.00%
+  |  C7-Pair: not covered
+  |  MC/DC Coverage for Decision: 14.29%
   |
   ------------------
-   LL|      0|        core::hint::black_box("hello");
-   LL|      1|    }
-   LL|      1|}
-   LL|       |
-   LL|      1|fn bad() {
-   LL|      1|    // With 7 conditions, fall back to branch instrumentation only.
-   LL|      1|    let [a, b, c, d, e, f, g] = <[bool; 7]>::default();
-   LL|      1|    if a && b && c && d && e && f && g {
-                          ^0   ^0   ^0   ^0   ^0   ^0
-  ------------------
-  |  Branch (LL:8): [True: 0, False: 1]
-  |  Branch (LL:13): [True: 0, False: 0]
-  |  Branch (LL:18): [True: 0, False: 0]
-  |  Branch (LL:23): [True: 0, False: 0]
-  |  Branch (LL:28): [True: 0, False: 0]
-  |  Branch (LL:33): [True: 0, False: 0]
-  |  Branch (LL:38): [True: 0, False: 0]
-  ------------------
-   LL|      0|        core::hint::black_box("hello");
+   LL|      1|        core::hint::black_box("hello");
    LL|      1|    }
-   LL|      1|}
+   LL|      2|}
    LL|       |
    LL|       |#[coverage(off)]
    LL|       |fn main() {
-   LL|       |    good();
-   LL|       |    bad();
+   LL|       |    accept_7_conditions([false; 7]);
+   LL|       |    accept_7_conditions([true; 7]);
    LL|       |}