|
| 1 | +// Test visualization of MC/DC constructs for constant-folded condition masking with different counted states. |
| 2 | + |
| 3 | +// RUN: llvm-profdata merge %S/Inputs/mcdc-exclude.proftext -o %t.profdata |
| 4 | +// RUN: llvm-cov show --show-mcdc %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=DEFAULTCASE |
| 5 | +// RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-exclude.cpp | FileCheck %s -check-prefix=REPORTDEFAULT |
| 6 | + |
| 7 | +// DEFAULTCASE: | MC/DC Coverage for Decision: 25.00% |
| 8 | + |
| 9 | +// REPORTDEFAULT: TOTAL {{.*}} 4 3 25.00% |
| 10 | + |
| 11 | +// RUN: llvm-cov show --show-mcdc --mcdc-exclude=uncoverable %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=EXCLUDEUNCOVERABECASE |
| 12 | +// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=uncoverable %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-exclude.cpp | FileCheck %s -check-prefix=REPORTEXCLUDEUNCOVERABLE |
| 13 | + |
| 14 | +// EXCLUDEUNCOVERABECASE: | MC/DC Coverage for Decision: 16.67% |
| 15 | + |
| 16 | +// REPORTEXCLUDEUNCOVERABLE: TOTAL {{.*}} 6 5 16.67% |
| 17 | + |
| 18 | +// RUN: llvm-cov show --show-mcdc --mcdc-exclude=constant %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=EXCLUDECONSTANTCASE |
| 19 | +// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=constant %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-exclude.cpp | FileCheck %s -check-prefix=REPORTEXCLUDECONSTANT |
| 20 | + |
| 21 | +// EXCLUDECONSTANTCASE: | MC/DC Coverage for Decision: 25.00% |
| 22 | + |
| 23 | +// REPORTEXCLUDECONSTANT: TOTAL {{.*}} 4 3 25.00% |
| 24 | + |
| 25 | +// RUN: llvm-cov show --show-mcdc --mcdc-exclude=unreachable %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=EXCLUDEUNREACHABLECASE |
| 26 | +// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=unreachable %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-exclude.cpp | FileCheck %s -check-prefix=REPORTEXCLUDEUNREACHABLE |
| 27 | + |
| 28 | +// EXCLUDEUNREACHABLECASE: | MC/DC Coverage for Decision: 20.00% |
| 29 | + |
| 30 | +// REPORTEXCLUDEUNREACHABLE: TOTAL {{.*}} 5 4 20.00% |
| 31 | + |
| 32 | +// RUN: llvm-cov show --show-mcdc --mcdc-exclude=none %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=INCLUDEALLCASE |
| 33 | +// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=none %S/Inputs/mcdc-exclude.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-exclude.cpp | FileCheck %s -check-prefix=REPORTALL |
| 34 | + |
| 35 | +// INCLUDEALLCASE: | MC/DC Coverage for Decision: 14.29% |
| 36 | + |
| 37 | +// REPORTALL: TOTAL {{.*}} 7 6 14.29% |
| 38 | +Instructions for regenerating the test: |
| 39 | + |
| 40 | +cd %S/Inputs # Or copy files into the working directory |
| 41 | + |
| 42 | +clang++ -c -Os \ |
| 43 | + -fcoverage-compilation-dir=. -mllvm -enable-name-compression=false \ |
| 44 | + -fcoverage-mcdc -fprofile-instr-generate -fcoverage-mapping \ |
| 45 | + mcdc-exclude.cpp |
| 46 | + |
| 47 | +# Instructions for regenerating proftext |
| 48 | + |
| 49 | +for x in mcdc-exclude; do ( |
| 50 | + clang++ -fprofile-instr-generate $x.o -o $x |
| 51 | + find -name '*.profraw' | xargs rm -f |
| 52 | + export LLVM_PROFILE_FILE=$x-%p.profraw |
| 53 | + ./$x 0 1 |
| 54 | + llvm-profdata merge --sparse -o $x.profdata $(find -name '*.profraw') |
| 55 | + llvm-profdata merge --text -o $x.proftext $x.profdata |
| 56 | +); done |
0 commit comments