-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[coverage] add option to exclude special conditions from MC/DC report
- Loading branch information
Showing
14 changed files
with
180 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <stdio.h> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void test(bool a,bool b, bool c, bool d) { | ||
|
||
if (a && (b || true || c) && ( true || d) && true) | ||
printf("test 1 decision true\n"); | ||
|
||
} | ||
|
||
int main() | ||
{ | ||
test(true,false,true,false); | ||
test(true,false,true,true); | ||
test(true,true,false,false); | ||
test(false,true,true,false); | ||
test(true,false,false,false); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
_Z4testbbbb | ||
# Func Hash: | ||
2877299778974865 | ||
# Num Counters: | ||
12 | ||
# Counter Values: | ||
5 | ||
4 | ||
4 | ||
4 | ||
4 | ||
4 | ||
0 | ||
0 | ||
3 | ||
0 | ||
0 | ||
0 | ||
# Num Bitmap Bytes: | ||
$3 | ||
# Bitmap Byte Values: | ||
0xc0 | ||
0x80 | ||
0x0 | ||
|
||
|
||
main | ||
# Func Hash: | ||
24 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Test visualization of MC/DC constructs for constant-folded condition masking with different counted states. | ||
|
||
// RUN: llvm-profdata merge %S/Inputs/mcdc-count.proftext -o %t.profdata | ||
// RUN: llvm-cov show --show-mcdc %S/Inputs/mcdc-count.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=DEFAULTCASE | ||
// RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-count.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-count.cpp | FileCheck %s -check-prefix=REPORTDEFAULT | ||
|
||
// DEFAULTCASE: | MC/DC Coverage for Decision: 50.00% | ||
|
||
// REPORTDEFAULT: TOTAL {{.*}} 2 1 50.00% | ||
|
||
// RUN: llvm-cov show --show-mcdc --mcdc-exclude=uncoverable %S/Inputs/mcdc-count.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=EXCLUDEUNCOVERABECASE | ||
// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=uncoverable %S/Inputs/mcdc-count.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-count.cpp | FileCheck %s -check-prefix=REPORTEXCLUDEUNCOVERABLE | ||
|
||
// EXCLUDEUNCOVERABECASE: | MC/DC Coverage for Decision: 16.67% | ||
|
||
// REPORTEXCLUDEUNCOVERABLE: TOTAL {{.*}} 6 5 16.67% | ||
|
||
// RUN: llvm-cov show --show-mcdc --mcdc-exclude=constant %S/Inputs/mcdc-count.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=EXCLUDECONSTANTCASE | ||
// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=constant %S/Inputs/mcdc-count.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-count.cpp | FileCheck %s -check-prefix=REPORTEXCLUDECONSTANT | ||
|
||
// EXCLUDECONSTANTCASE: | MC/DC Coverage for Decision: 25.00% | ||
|
||
// REPORTEXCLUDECONSTANT: TOTAL {{.*}} 4 3 25.00% | ||
|
||
// RUN: llvm-cov show --show-mcdc --mcdc-exclude=unreachable %S/Inputs/mcdc-count.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %s -check-prefix=EXCLUDEUNREACHABLECASE | ||
// RUN: llvm-cov report --show-mcdc-summary --mcdc-exclude=unreachable %S/Inputs/mcdc-count.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-count.cpp | FileCheck %s -check-prefix=REPORTEXCLUDEUNREACHABLE | ||
|
||
// EXCLUDEUNREACHABLECASE: | MC/DC Coverage for Decision: 20.00% | ||
|
||
// REPORTEXCLUDEUNREACHABLE: TOTAL {{.*}} 5 4 20.00% | ||
|
||
Instructions for regenerating the test: | ||
|
||
cd %S/Inputs # Or copy files into the working directory | ||
|
||
clang++ -c -Os \ | ||
-fcoverage-compilation-dir=. -mllvm -enable-name-compression=false \ | ||
-fcoverage-mcdc -fprofile-instr-generate -fcoverage-mapping \ | ||
mcdc-count.cpp | ||
|
||
# Instructions for regenerating proftext | ||
|
||
for x in mcdc-count; do ( | ||
clang++ -fprofile-instr-generate $x.o -o $x | ||
find -name '*.profraw' | xargs rm -f | ||
export LLVM_PROFILE_FILE=$x-%p.profraw | ||
./$x 0 1 | ||
llvm-profdata merge --sparse -o $x.profdata $(find -name '*.profraw') | ||
llvm-profdata merge --text -o $x.proftext $x.profdata | ||
); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters