xref: /llvm-project/llvm/test/tools/llvm-cov/dir-with-filtering.test (revision ca4e80182e38e844ba6342847c61a878e5689789)
1RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata
2
3// Test TEXT both files
4
5RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -o %t.text -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main -name=f2
6
7RUN: FileCheck -input-file=%t.text/index.txt %s -check-prefix=TEXT-INDEX
8TEXT-INDEX: dir-with-filtering1.cpp 1 0 100.00% 1 0 100.00% 4 0 100.00%
9TEXT-INDEX: dir-with-filtering2.cpp 1 1 0.00% 1 1 0.00% 3 3 0.00%
10
11RUN: FileCheck -input-file=%t.text/coverage/tmp/dir-with-filtering1.cpp.txt %s -check-prefix=TEXT-FILE1
12TEXT-FILE1: Coverage Report
13TEXT-FILE1-NOT: _Z2f1v:
14TEXT-FILE1: main:
15TEXT-FILE1-NEXT: {{.*}}int main()
16TEXT-FILE1-NOT: _Z2f1v:
17
18RUN: FileCheck -input-file=%t.text/coverage/tmp/dir-with-filtering2.cpp.txt %s -check-prefix=TEXT-FILE2
19TEXT-FILE2: Coverage Report
20TEXT-FILE2-NOT: _Z2f3v:
21TEXT-FILE2: _Z2f2v:
22TEXT-FILE2-NEXT: {{.*}}int f2()
23TEXT-FILE2-NOT: _Z2f3v:
24
25// Test TEXT one file
26
27RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -o %t.text_one_file -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main -name=f2 %S/Inputs/dir-with-filtering1.cpp
28
29RUN: FileCheck -input-file=%t.text_one_file/index.txt %s -check-prefix=TEXT-INDEX-ONE-FILE
30TEXT-INDEX-ONE-FILE: dir-with-filtering1.cpp 1 0 100.00% 1 0 100.00% 4 0 100.00%
31TEXT-INDEX-ONE-FILE-NOT: dir-with-filtering2.cpp
32
33RUN: FileCheck -input-file=%t.text_one_file/coverage/tmp/dir-with-filtering1.cpp.txt %s -check-prefix=TEXT-FILE1
34
35// Test TEXT index file with all functions in one file filtered out
36
37RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -o %t.text_one_func -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main
38RUN: FileCheck -input-file=%t.text_one_func/index.txt %s -check-prefix=TEXT-INDEX-ONE-FUNC
39
40TEXT-INDEX-ONE-FUNC-NOT: Files which contain no functions
41TEXT-INDEX-ONE-FUNC-NOT: dir-with-filtering2.cpp
42
43// Test HTML both files
44
45RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata
46RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -format html -o %t.html -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main -name=f2
47
48RUN: FileCheck -input-file=%t.html/index.html %s -check-prefix=HTML-INDEX
49HTML-INDEX: <h2>Coverage Report</h2>
50HTML-INDEX: dir-with-filtering1.cpp{{.*}}100.00% (1/1){{.*}}100.00% (4/4){{.*}}100.00% (1/1)
51HTML-INDEX: dir-with-filtering2.cpp{{.*}}0.00% (0/1){{.*}}0.00% (0/3){{.*}}0.00% (0/1)
52
53RUN: FileCheck -input-file=%t.html/coverage/tmp/dir-with-filtering1.cpp.html %s -check-prefix=HTML-FILE1
54HTML-FILE1-NOT: <pre>f1</pre>
55HTML-FILE1: <pre>main</pre>
56HTML-FILE1-NOT: <pre>f1</pre>
57HTML-FILE1: int main()
58HTML-FILE1-NOT: <pre>f1</pre>
59
60RUN: FileCheck -input-file=%t.html/coverage/tmp/dir-with-filtering2.cpp.html %s -check-prefix=HTML-FILE2
61HTML-FILE2-NOT: <pre>f3</pre>
62HTML-FILE2: <pre>_Z2f2v</pre>
63HTML-FILE2-NOT: <pre>f3</pre>
64HTML-FILE2: int f2()
65HTML-FILE2-NOT: <pre>f3</pre>
66
67// Test HTML one file
68
69RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata
70RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -format html -o %t.html_one_file -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main -name=f2 %S/Inputs/dir-with-filtering1.cpp
71
72RUN: FileCheck -input-file=%t.html_one_file/index.html %s -check-prefix=HTML-INDEX-ONE-FILE
73HTML-INDEX-ONE-FILE: <h2>Coverage Report</h2>
74HTML-INDEX-ONE-FILE: dir-with-filtering1.cpp{{.*}}100.00% (1/1){{.*}}100.00% (4/4){{.*}}100.00% (1/1)
75HTML-INDEX-ONE-FILE-NOT: dir-with-filtering2.cpp
76
77RUN: FileCheck -input-file=%t.html_one_file/coverage/tmp/dir-with-filtering1.cpp.html %s -check-prefix=HTML-FILE1
78
79// Test HTML index file with all functions in one file filtered out
80
81RUN: llvm-cov show %S/Inputs/dir-with-filtering.covmapping -format html -o %t.html_one_func -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main
82RUN: FileCheck -input-file=%t.html_one_func/index.html %s -check-prefix=HTML-INDEX-ONE-FUNC
83
84HTML-INDEX-ONE-FUNC-NOT: Files which contain no functions
85HTML-INDEX-ONE-FUNC-NOT: dir-with-filtering2.cpp
86