forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import Alan's testcase from llvm#78819
- Loading branch information
Showing
4 changed files
with
174 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#define C c | ||
#define D 1 | ||
#define E (C != a) && (C > a) | ||
#define F E | ||
|
||
void __attribute__((noinline)) func1(void) { return; } | ||
|
||
void __attribute__((noinline)) func(int a, int b, int c) { | ||
if (a && D && E || b) | ||
func1(); | ||
if (b && D) | ||
func1(); | ||
if (a && (b && C) || (D && F)) | ||
func1(); | ||
} | ||
|
||
int main() { | ||
func(2, 3, 3); | ||
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,62 @@ | ||
main | ||
# Func Hash: | ||
24 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
1 | ||
|
||
foo | ||
# Func Hash: | ||
395201011017399473 | ||
# Num Counters: | ||
22 | ||
# Counter Values: | ||
1 | ||
1 | ||
0 | ||
0 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
1 | ||
0 | ||
1 | ||
1 | ||
1 | ||
0 | ||
0 | ||
0 | ||
0 | ||
# Num Bitmap Bytes: | ||
$13 | ||
# Bitmap Byte Values: | ||
0x0 | ||
0x0 | ||
0x0 | ||
0x20 | ||
0x8 | ||
0x0 | ||
0x20 | ||
0x0 | ||
0x0 | ||
0x0 | ||
0x0 | ||
0x0 | ||
0x0 | ||
|
||
|
||
bar | ||
# Func Hash: | ||
24 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
3 | ||
|
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,92 @@ | ||
// Test visualization of MC/DC constructs for branches in macro expansions. | ||
|
||
// RUN: llvm-profdata merge %S/Inputs/mcdc-macro.proftext -o %t.profdata | ||
// RUN: llvm-cov show --show-expansions --show-branches=count --show-mcdc %S/Inputs/mcdc-macro.o -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs %S/Inputs/mcdc-macro.c | FileCheck %s | ||
|
||
// CHECK: | | | Branch (2:11): [Folded - Ignored] | ||
// CHECK: | | | Branch (3:11): [True: 0, False: 0] | ||
// CHECK: | | | Branch (3:23): [True: 0, False: 0] | ||
// CHECK: | Branch (9:7): [True: 0, False: 0] | ||
// CHECK-NEXT: | Branch (9:22): [True: 0, False: 0] | ||
// CHECK-NEXT: ------------------ | ||
// CHECK-NEXT: |---> MC/DC Decision Region (9:7) to (9:23) | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | Number of Conditions: 5 | ||
// CHECK-NEXT: | Condition C1 --> (9:7) | ||
// CHECK-NEXT: | Condition C2 --> (2:11) | ||
// CHECK-NEXT: | Condition C3 --> (3:11) | ||
// CHECK-NEXT: | Condition C4 --> (3:23) | ||
// CHECK-NEXT: | Condition C5 --> (9:22) | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | Executed MC/DC Test Vectors: | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | None. | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | C1-Pair: not covered | ||
// CHECK-NEXT: | C2-Pair: constant folded | ||
// CHECK-NEXT: | C3-Pair: not covered | ||
// CHECK-NEXT: | C4-Pair: not covered | ||
// CHECK-NEXT: | C5-Pair: not covered | ||
// CHECK-NEXT: | MC/DC Coverage for Decision: 0.00% | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: ------------------ | ||
|
||
// CHECK: | | | Branch (2:11): [Folded - Ignored] | ||
// CHECK: | Branch (11:7): [True: 0, False: 0] | ||
// CHECK-NEXT: ------------------ | ||
// CHECK-NEXT: |---> MC/DC Decision Region (11:7) to (11:13) | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | Number of Conditions: 2 | ||
// CHECK-NEXT: | Condition C1 --> (11:7) | ||
// CHECK-NEXT: | Condition C2 --> (2:11) | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | Executed MC/DC Test Vectors: | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | None. | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | C1-Pair: not covered | ||
// CHECK-NEXT: | C2-Pair: constant folded | ||
// CHECK-NEXT: | MC/DC Coverage for Decision: 0.00% | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: ------------------ | ||
|
||
// CHECK: | | | Branch (1:11): [True: 0, False: 0] | ||
// CHECK: | | | Branch (2:11): [Folded - Ignored] | ||
// CHECK: | | | | | Branch (3:11): [True: 0, False: 0] | ||
// CHECK: | | | | | Branch (3:23): [True: 0, False: 0] | ||
// CHECK: | Branch (13:7): [True: 0, False: 0] | ||
// CHECK-NEXT: | Branch (13:13): [True: 0, False: 0] | ||
// CHECK-NEXT: ------------------ | ||
// CHECK-NEXT: |---> MC/DC Decision Region (13:7) to (13:32) | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | Number of Conditions: 6 | ||
// CHECK-NEXT: | Condition C1 --> (13:7) | ||
// CHECK-NEXT: | Condition C2 --> (13:13) | ||
// CHECK-NEXT: | Condition C3 --> (1:11) | ||
// CHECK-NEXT: | Condition C4 --> (2:11) | ||
// CHECK-NEXT: | Condition C5 --> (3:11) | ||
// CHECK-NEXT: | Condition C6 --> (3:23) | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | Executed MC/DC Test Vectors: | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | None. | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: | C1-Pair: not covered | ||
// CHECK-NEXT: | C2-Pair: not covered | ||
// CHECK-NEXT: | C3-Pair: not covered | ||
// CHECK-NEXT: | C4-Pair: constant folded | ||
// CHECK-NEXT: | C5-Pair: not covered | ||
// CHECK-NEXT: | C6-Pair: not covered | ||
// CHECK-NEXT: | MC/DC Coverage for Decision: 0.00% | ||
// CHECK-NEXT: | | ||
// CHECK-NEXT: ------------------ | ||
|
||
Instructions for regenerating the test: | ||
|
||
# cd %S/Inputs | ||
cp mcdc-macro.c /tmp | ||
|
||
clang -fcoverage-mcdc -fprofile-instr-generate -fcoverage-compilation-dir=. \ | ||
-fcoverage-mapping /tmp/mcdc-macro.c -o /tmp/mcdc-macro.o | ||
|
||
mv /tmp/mcdc-macro.o %S/Inputs |