1 | // REQUIRES: linux |
2 | // RUN: %clang_profgen -Wl,--build-id=none -O2 -o %t %s |
3 | // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t |
4 | // RUN: llvm-profdata show --binary-ids %t.profraw > %t.out |
5 | // RUN: FileCheck %s --check-prefix=NO-BINARY-ID < %t.out |
6 | // RUN: llvm-profdata merge -o %t.profdata %t.profraw |
7 | |
8 | // RUN: %clang_profgen -Wl,--build-id -O2 -o %t %s |
9 | // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t |
10 | // RUN: llvm-profdata show --binary-ids %t.profraw > %t.profraw.out |
11 | // RUN: FileCheck %s --check-prefix=BINARY-ID-RAW-PROF < %t.profraw.out |
12 | |
13 | // RUN: rm -rf %t.profdir |
14 | // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t |
15 | // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t |
16 | // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t |
17 | // RUN: llvm-profdata show --binary-ids %t.profdir/default_*.profraw > %t.profraw.out |
18 | // RUN: FileCheck %s --check-prefix=BINARY-ID-MERGE-PROF < %t.profraw.out |
19 | |
20 | // RUN: llvm-profdata merge -o %t.profdata %t.profdir/default_*.profraw |
21 | // RUN: llvm-profdata show --binary-ids %t.profdata > %t.profdata.out |
22 | // RUN: FileCheck %s --check-prefix=BINARY-ID-INDEXED-PROF < %t.profdata.out |
23 | |
24 | // Test raw profiles with shared libraries. |
25 | // RUN: split-file %s %t.dir |
26 | // RUN: %clang_profgen -Wl,--build-id -fpic -shared -O2 %t.dir/foo.c -o %t.dir/libfoo.so |
27 | // RUN: %clang_profgen -Wl,--build-id -fpic -shared -O2 %t.dir/bar.c -o %t.dir/libbar.so |
28 | // RUN: %clang_profgen -Wl,--build-id -O2 %t.dir/main.c %t.dir/libfoo.so %t.dir/libbar.so -o %t |
29 | // RUN: env LLVM_PROFILE_FILE=%t.profraw LD_LIBRARY_PATH=%t.dir %run %t |
30 | // RUN: llvm-profdata show --binary-ids %t.profraw > %t.profraw.out |
31 | // RUN: llvm-profdata merge -o %t.profdata %t.profraw |
32 | // RUN: FileCheck %s --check-prefix=BINARY-ID-SHARE-RAW-PROF < %t.profraw.out |
33 | |
34 | // RUN: llvm-profdata merge -o %t.profdata %t.profraw |
35 | // RUN: llvm-profdata show --binary-ids %t.profdata > %t.profdata.out |
36 | // RUN: FileCheck %s --check-prefix=BINARY-ID-SHARE-INDEXED-PROF < %t.profraw.out |
37 | |
38 | //--- foo.c |
39 | void foo() { |
40 | } |
41 | |
42 | //--- bar.c |
43 | void bar() { |
44 | } |
45 | |
46 | //--- main.c |
47 | void foo(); |
48 | void bar(); |
49 | int main() { |
50 | foo(); |
51 | bar(); |
52 | return 0; |
53 | } |
54 | |
55 | // NO-BINARY-ID: Instrumentation level: Front-end |
56 | // NO-BINARY-ID-NEXT: Total functions: 3 |
57 | // NO-BINARY-ID-NEXT: Maximum function count: 1 |
58 | // NO-BINARY-ID-NEXT: Maximum internal block count: 0 |
59 | // NO-BINARY-ID-NOT: Binary IDs: |
60 | |
61 | // BINARY-ID-RAW-PROF: Instrumentation level: Front-end |
62 | // BINARY-ID-RAW-PROF-NEXT: Total functions: 3 |
63 | // BINARY-ID-RAW-PROF-NEXT: Maximum function count: 1 |
64 | // BINARY-ID-RAW-PROF-NEXT: Maximum internal block count: 0 |
65 | // BINARY-ID-RAW-PROF-NEXT: Binary IDs: |
66 | // BINARY-ID-RAW-PROF-NEXT: {{[0-9a-f]+}} |
67 | |
68 | // BINARY-ID-MERGE-PROF: Instrumentation level: Front-end |
69 | // BINARY-ID-MERGE-PROF-NEXT: Total functions: 3 |
70 | // BINARY-ID-MERGE-PROF-NEXT: Maximum function count: 3 |
71 | // BINARY-ID-MERGE-PROF-NEXT: Maximum internal block count: 0 |
72 | // BINARY-ID-MERGE-PROF-NEXT: Binary IDs: |
73 | // BINARY-ID-MERGE-PROF-NEXT: {{[0-9a-f]+}} |
74 | |
75 | // BINARY-ID-INDEXED-PROF: Instrumentation level: Front-end |
76 | // BINARY-ID-INDEXED-PROF-NEXT: Total functions: 3 |
77 | // BINARY-ID-INDEXED-PROF-NEXT: Maximum function count: 3 |
78 | // BINARY-ID-INDEXED-PROF-NEXT: Maximum internal block count: 0 |
79 | // BINARY-ID-INDEXED-PROF-NEXT: Binary IDs: |
80 | // BINARY-ID-INDEXED-PROF-NEXT: {{[0-9a-f]+}} |
81 | |
82 | // BINARY-ID-SHARE-RAW-PROF: Instrumentation level: Front-end |
83 | // BINARY-ID-SHARE-RAW-PROF-NEXT: Total functions: 3 |
84 | // BINARY-ID-SHARE-RAW-PROF-NEXT: Maximum function count: 1 |
85 | // BINARY-ID-SHARE-RAW-PROF-NEXT: Maximum internal block count: 0 |
86 | // BINARY-ID-SHARE-RAW-PROF-NEXT: Binary IDs: |
87 | // BINARY-ID-SHARE-RAW-PROF-NEXT: {{[0-9a-f]+}} |
88 | // BINARY-ID-SHARE-RAW-PROF-NEXT: {{[0-9a-f]+}} |
89 | // BINARY-ID-SHARE-RAW-PROF-NEXT: {{[0-9a-f]+}} |
90 | |
91 | // BINARY-ID-SHARE-INDEXED-PROF: Instrumentation level: Front-end |
92 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: Total functions: 3 |
93 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: Maximum function count: 1 |
94 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: Maximum internal block count: 0 |
95 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: Binary IDs: |
96 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: {{[0-9a-f]+}} |
97 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: {{[0-9a-f]+}} |
98 | // BINARY-ID-SHARE-INDEXED-PROF-NEXT: {{[0-9a-f]+}} |
99 | |