xref: /llvm-project/llvm/test/tools/llvm-cov/gcov/intermediate-format.test (revision 878deaeeadb940c892908cb51356b60000626db8)
1RUN: rm -rf %t && mkdir %t && cd %t
2RUN: cp %S/Inputs/test.gcno %S/Inputs/test.gcda .
3
4RUN: llvm-cov gcov -i test.cpp 2> %t.err | FileCheck %s --check-prefixes=OUT
5RUN: FileCheck %s --check-prefix=I < test.cpp.gcov
6RUN: cp test.cpp.gcov saved.cpp.gcov
7
8# -i does not read source files. No ENOENT diagnostic.
9RUN: count 0 < %t.err
10
11# -n suppresses the .gcov output.
12RUN: llvm-cov gcov -i -n test. | FileCheck %s --check-prefixes=OUT
13RUN: not ls test..gcov
14
15# The output filename is formed by appending ".gcov" to the specifiled filename.
16RUN: llvm-cov gcov -i test. | FileCheck %s --check-prefix=OUT
17RUN: cmp test..gcov saved.cpp.gcov
18
19RUN: llvm-cov gcov -i -b test.cpp | FileCheck %s --check-prefixes=OUT,OUT-B
20RUN: FileCheck %s --check-prefixes=I,I-B --match-full-lines --strict-whitespace < test.cpp.gcov
21
22# Many other options are ignored.
23RUN: rm -f test.cpp.gcov && llvm-cov gcov -i -a -c -l -p -u -x test.cpp
24RUN: cmp test.cpp.gcov saved.cpp.gcov
25
26         OUT:File 'test.cpp'
27    OUT-NEXT:Lines executed:81.40% of 43
28  OUT-B-NEXT:Branches executed:100.00% of 15
29  OUT-B-NEXT:Taken at least once:86.67% of 15
30  OUT-B-NEXT:No calls
31   OUT-EMPTY:
32    OUT-NEXT:File 'test.h'
33    OUT-NEXT:Lines executed:100.00% of 1
34  OUT-B-NEXT:No branches
35  OUT-B-NEXT:No calls
36   OUT-EMPTY:
37
38       I:file:test.cpp
39       I:function:10,4294967296,_ZN1A1BEv
40  I-NEXT:function:12,0,_Z7uselessv
41  I-NEXT:function:14,0,_Z12more_uselessv
42  I-NEXT:function:18,1,_Z3foov
43  I-NEXT:function:23,0,_Z3barv
44  I-NEXT:function:28,4,_Z6assignii
45  I-NEXT:function:32,1,_Z15initialize_gridv
46  I-NEXT:function:38,1,main
47       I:lcount:10,4294967296
48       I:lcount:33,3
49I-B-NEXT:branch:33,taken
50I-B-NEXT:branch:33,taken
51       I:file:test.h
52  I-NEXT:function:2,1,_ZN1AC2Ev
53  I-NEXT:lcount:2,1
54