coverage. Adapt to mcdc mapping formats introduced by llvm 19
This commit is contained in:
parent
99bd601df5
commit
6e3e19f714
22 changed files with 490 additions and 485 deletions
|
@ -4,22 +4,8 @@
|
|||
//@ compile-flags: -Zcoverage-options=mcdc
|
||||
//@ llvm-cov-flags: --show-branches=count --show-mcdc
|
||||
|
||||
// Check that MC/DC instrumentation can gracefully handle conditions that
|
||||
// exceed LLVM's limit of 6 conditions per decision.
|
||||
//
|
||||
// (The limit is enforced in `compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs`.)
|
||||
|
||||
fn good() {
|
||||
// With only 6 conditions, perform full MC/DC instrumentation.
|
||||
let [a, b, c, d, e, f] = <[bool; 6]>::default();
|
||||
if a && b && c && d && e && f {
|
||||
core::hint::black_box("hello");
|
||||
}
|
||||
}
|
||||
|
||||
fn bad() {
|
||||
// With 7 conditions, fall back to branch instrumentation only.
|
||||
let [a, b, c, d, e, f, g] = <[bool; 7]>::default();
|
||||
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");
|
||||
}
|
||||
|
@ -27,6 +13,6 @@ fn bad() {
|
|||
|
||||
#[coverage(off)]
|
||||
fn main() {
|
||||
good();
|
||||
bad();
|
||||
accept_7_conditions([false; 7]);
|
||||
accept_7_conditions([true; 7]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue