xref: /llvm-project/llvm/test/tools/llvm-profdata/mcdc-bitmap.test (revision f95b2f1acf1171abb0d00089fd4c9238753847e3)
1# Test MC/DC bitmap reading and merging.
2
3# Merge as profdata.
4RUN: split-file %s %t
5RUN: llvm-profdata merge %t/mcdc-1.proftext %t/mcdc-2.proftext -o %t.profdata
6RUN: llvm-profdata show %t.profdata --text -all-functions | FileCheck %s --check-prefix=MCDC
7# Merge as proftext.
8RUN: llvm-profdata merge %t/mcdc-1.proftext %t/mcdc-2.proftext -o %t.proftext
9RUN: llvm-profdata show %t.proftext --text -all-functions | FileCheck %s --check-prefix=MCDC
10
11MCDC: # Num Bitmap Bytes:
12MCDC-NEXT: $1
13MCDC-NEXT: # Bitmap Byte Values:
14MCDC-NEXT: a
15MCDC: # Num Bitmap Bytes:
16MCDC-NEXT: $2
17MCDC-NEXT: # Bitmap Byte Values:
18MCDC-NEXT: 0x29
19MCDC-NEXT: 0x0
20
21# Merge as profdata.
22RUN: llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-4.proftext -o %t.profdata
23RUN: llvm-profdata show %t.profdata --text -all-functions | FileCheck %s --check-prefix=MCDC2
24# Merge as proftext.
25RUN: llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-4.proftext -o %t.proftext
26RUN: llvm-profdata show %t.proftext --text -all-functions | FileCheck %s --check-prefix=MCDC2
27
28MCDC2: # Num Bitmap Bytes:
29MCDC2-NEXT: $8
30MCDC2-NEXT: # Bitmap Byte Values:
31MCDC2-NEXT: 0x1
32MCDC2-NEXT: 0x2
33MCDC2-NEXT: 0x3
34MCDC2-NEXT: 0xf
35MCDC2-NEXT: 0xf
36MCDC2-NEXT: 0xe
37MCDC2-NEXT: 0xf
38MCDC2-NEXT: 0xa
39
40# Incompatible size mismatch.
41RUN: llvm-profdata merge %t/mcdc-2.proftext %t/mcdc-4.proftext -o %t.profdata 2>&1 | FileCheck %s --check-prefix=MCDC3
42# Merge as proftext
43RUN: llvm-profdata merge %t/mcdc-2.proftext %t/mcdc-4.proftext -o %t.proftext 2>&1 | FileCheck %s --check-prefix=MCDC3
44
45MCDC3: function bitmap size change detected (bitmap size mismatch)
46
47# Invalid number of bitmap bytes.
48RUN: not llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-err0.proftext -o %t.proftext 2>&1 | FileCheck %s --check-prefix=MCDC4
49
50MCDC4: malformed instrumentation profile data: number of bitmap bytes is not a valid integer
51
52# Invalid bitmap byte.
53RUN: not llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-err1.proftext -o %t.proftext 2>&1 | FileCheck %s --check-prefix=MCDC5
54
55MCDC5: malformed instrumentation profile data: bitmap byte is not a valid integer
56
57;--- mcdc-1.proftext
58main
59# Func Hash:
60702755447896
61# Num Counters:
624
63# Counter Values:
641
650
661
670
68# Num Bitmask Bytes:
69$1
70# Bitmask Byte Values:
712
72;--- mcdc-2.proftext
73main
74# Func Hash:
75702755447896
76# Num Counters:
774
78# Counter Values:
791
801
811
821
83# Num Bitmask Bytes:
84$1
85# Bitmask Byte Values:
868
87
88
89test3
90# Func Hash:
9115288018065
92# Num Counters:
936
94# Counter Values:
954
962
971
980
990
1002
101# Num Bitmask Bytes:
102$0x2
103# Bitmask Byte Values:
1040x29
1050x0
106;--- mcdc-3.proftext
107test3
108# Func Hash:
10915288018065
110# Num Counters:
1116
112# Counter Values:
1134
1142
1151
1160
1170
1182
119# Num Bitmask Bytes:
120$8
121# Bitmask Byte Values:
1220x0
1230x2
1240x3
1250xf
1260xf
1270xa
1280xc
1290x2
130;--- mcdc-4.proftext
131test3
132# Func Hash:
13315288018065
134# Num Counters:
1356
136# Counter Values:
1374
1382
1391
1400
1410
1422
143# Num Bitmask Bytes:
144$       8
145# Bitmask Byte Values:
1461
1472
1483
1494
1505
1516
1527
1538
154;--- mcdc-err0.proftext
155test3
156# Func Hash:
15715288018065
158# Num Counters:
1596
160# Counter Values:
1614
1622
1631
1640
1650
1662
167# Num Bitmask Bytes:
168$8.9
169# Bitmask Byte Values:
1701
1712
1723
1734
1745
1756
1767
1778
178;--- mcdc-err1.proftext
179test3
180# Func Hash:
18115288018065
182# Num Counters:
1836
184# Counter Values:
1854
1862
1871
1880
1890
1902
191# Num Bitmask Bytes:
192$8
193# Bitmask Byte Values:
1941
1952
1963
1974
1985.4
1996
2007
2018
202