xref: /llvm-project/compiler-rt/test/profile/ContinuousSyncMode/basic.c (revision de294c968bf292794ca9f0a6a481d3dff3bcc2eb)
1 // REQUIRES: continuous-mode
2 
3 // RUN: %clang_profgen_cont -fcoverage-mapping -o %t.exe %s
4 // RUN: echo "garbage" > %t.profraw
5 // RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe
6 // RUN: llvm-profdata show --counts --all-functions %t.profraw | FileCheck %s -check-prefix=CHECK-COUNTS
7 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
8 //
9 // COM: The "report" and "show" commands of llvm-cov are not supported on AIX.
10 // RUN: %if !target={{.*aix.*}} %{ \
11 // RUN:   llvm-cov report %t.exe -instr-profile %t.profdata | FileCheck %s -check-prefix=CHECK-COVERAGE \
12 // RUN: %}
13 
14 // CHECK-COUNTS: Counters:
15 // CHECK-COUNTS-NEXT:   main:
16 // CHECK-COUNTS-NEXT:     Hash: 0x{{.*}}
17 // CHECK-COUNTS-NEXT:     Counters: 2
18 // CHECK-COUNTS-NEXT:     Function count: 1
19 // CHECK-COUNTS-NEXT:     Block counts: [1]
20 // CHECK-COUNTS-NEXT: Instrumentation level: Front-end
21 // CHECK-COUNTS-NEXT: Functions shown: 1
22 // CHECK-COUNTS-NEXT: Total functions: 1
23 // CHECK-COUNTS-NEXT: Maximum function count: 1
24 // CHECK-COUNTS-NEXT: Maximum internal block count: 1
25 
26 // CHECK-COVERAGE: Filename    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover
27 // CHECK-COVERAGE-NEXT: ---
28 // CHECK-COVERAGE-NEXT: basic.c      4                 1    75.00%           1                 0   100.00%           5                 1    80.00%
29 // CHECK-COVERAGE-NEXT: ---
30 // CHECK-COVERAGE-NEXT: TOTAL        4                 1    75.00%           1                 0   100.00%           5                 1    80.00%
31 
32 extern int __llvm_profile_is_continuous_mode_enabled(void);
33 
34 int main() {
35   if (__llvm_profile_is_continuous_mode_enabled())
36     return 0;
37   return 1;
38 }
39