1 // RUN: %clang -fprofile-instr-generate -fcoverage-mapping -o %t.exe %s
2 // RUN: echo "garbage" > %t.profraw
3 // RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe
4 // RUN: llvm-profdata show --counts --all-functions %t.profraw | FileCheck %s -check-prefix=CHECK-COUNTS
5 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
6 // RUN: llvm-cov report %t.exe -instr-profile %t.profdata | FileCheck %s -check-prefix=CHECK-COVERAGE
7 
8 // CHECK-COUNTS: Counters:
9 // CHECK-COUNTS-NEXT:   main:
10 // CHECK-COUNTS-NEXT:     Hash: 0x{{.*}}
11 // CHECK-COUNTS-NEXT:     Counters: 2
12 // CHECK-COUNTS-NEXT:     Function count: 1
13 // CHECK-COUNTS-NEXT:     Block counts: [1]
14 // CHECK-COUNTS-NEXT: Instrumentation level: Front-end
15 // CHECK-COUNTS-NEXT: Functions shown: 1
16 // CHECK-COUNTS-NEXT: Total functions: 1
17 // CHECK-COUNTS-NEXT: Maximum function count: 1
18 // CHECK-COUNTS-NEXT: Maximum internal block count: 1
19 
20 // CHECK-COVERAGE: Filename    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover
21 // CHECK-COVERAGE-NEXT: ---
22 // CHECK-COVERAGE-NEXT: basic.c      4                 1    75.00%           1                 0   100.00%           5                 2    60.00%
23 // CHECK-COVERAGE-NEXT: ---
24 // CHECK-COVERAGE-NEXT: TOTAL        4                 1    75.00%           1                 0   100.00%           5                 2    60.00%
25 
26 extern int __llvm_profile_is_continuous_mode_enabled(void);
27 
28 int main() {
29   if (__llvm_profile_is_continuous_mode_enabled())
30     return 0;
31   return 1;
32 }
33