1// RUN: mkdir -p %t.dir && cd %t.dir
2
3/// gcov 3.4 redesigned the format and changed the extension from .da to .gcda
4// RUN: %clang --coverage -Xclang -coverage-version='304*' %s -o %t -dumpdir ./
5// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
6// RUN: llvm-cov gcov -t gcov-basic.gcno | FileCheck %s
7
8/// r173147: split checksum into cfg checksum and line checksum.
9// RUN: %clang --coverage -Xclang -coverage-version='407*' %s -o %t -dumpdir ./
10// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
11// RUN: llvm-cov gcov -t gcov-basic.gcno | FileCheck %s
12
13/// r189778: the exit block moved from the last to the second.
14// RUN: %clang --coverage -Xclang -coverage-version='408*' %s -o %t -dumpdir ./
15// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
16// RUN: llvm-cov gcov -t gcov-basic.gcno
17
18/// PR gcov-profile/48463
19// RUN: %clang --coverage -Xclang -coverage-version='800*' %s -o %t -dumpdir ./
20// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
21// RUN: llvm-cov gcov -t gcov-basic.gcno
22
23/// PR gcov-profile/84846, r269678
24// RUN: %clang --coverage -Xclang -coverage-version='900*' %s -o %t -dumpdir ./
25// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
26// RUN: llvm-cov gcov -t gcov-basic.gcno
27
28// CHECK: Runs:2
29
30#include <stdio.h>
31
32int main(int argc, char *argv[]) { // CHECK: 2: [[@LINE]]:int main
33 if (argc > 1) // CHECK-NEXT: 2: [[@LINE]]:
34 puts(s: "hello"); // CHECK-NEXT: 1: [[@LINE]]:
35 return 0; // CHECK-NEXT: 2: [[@LINE]]:
36}
37

source code of compiler-rt/test/profile/gcov-basic.c