Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-cov] Create directory structure when filtering using -name*= op…
…tions Before this change using any of the -name*= command line options with an output directory would result in a single file (functions.txt/functions.html) containing the coverage for those specific functions. Now you get the same directory structure as when not using any -name*= options. Differential Revision: https://reviews.llvm.org/D38280 llvm-svn: 314396
- Loading branch information
1 parent
89d2be0
commit fa8ef35
Showing
19 changed files
with
215 additions
and
64 deletions.
There are no files selected for viewing
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
llvm/test/tools/llvm-cov/Inputs/dir-with-filtering.proftext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
main | ||
# Func Hash: | ||
0 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
1 | ||
|
||
_Z2f1v | ||
# Func Hash: | ||
0 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
1 | ||
|
||
_Z2f2v | ||
# Func Hash: | ||
0 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
0 | ||
|
||
_Z2f3v | ||
# Func Hash: | ||
0 | ||
# Num Counters: | ||
1 | ||
# Counter Values: | ||
0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
int f1() { | ||
return 1; | ||
} | ||
|
||
int main() { | ||
f1(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
int f2() { | ||
return 2; | ||
} | ||
|
||
int f3() { | ||
return 3; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata | ||
|
||
// Test TEXT both files | ||
|
||
RUN: 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 | ||
|
||
RUN: FileCheck -input-file=%t.text/index.txt %s -check-prefix=TEXT-INDEX | ||
TEXT-INDEX: dir-with-filtering1.cpp 1 0 100.00% 1 0 100.00% 4 0 100.00% | ||
TEXT-INDEX: dir-with-filtering2.cpp 1 1 0.00% 1 1 0.00% 3 3 0.00% | ||
|
||
RUN: FileCheck -input-file=%t.text/coverage/tmp/dir-with-filtering1.cpp.txt %s -check-prefix=TEXT-FILE1 | ||
TEXT-FILE1: Coverage Report | ||
TEXT-FILE1-NOT: _Z2f1v: | ||
TEXT-FILE1: main: | ||
TEXT-FILE1-NEXT: {{.*}}int main() | ||
TEXT-FILE1-NOT: _Z2f1v: | ||
|
||
RUN: FileCheck -input-file=%t.text/coverage/tmp/dir-with-filtering2.cpp.txt %s -check-prefix=TEXT-FILE2 | ||
TEXT-FILE2: Coverage Report | ||
TEXT-FILE2-NOT: _Z2f3v: | ||
TEXT-FILE2: _Z2f2v: | ||
TEXT-FILE2-NEXT: {{.*}}int f2() | ||
TEXT-FILE2-NOT: _Z2f3v: | ||
|
||
// Test TEXT one file | ||
|
||
RUN: 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 | ||
|
||
RUN: FileCheck -input-file=%t.text_one_file/index.txt %s -check-prefix=TEXT-INDEX-ONE-FILE | ||
TEXT-INDEX-ONE-FILE: dir-with-filtering1.cpp 1 0 100.00% 1 0 100.00% 4 0 100.00% | ||
TEXT-INDEX-ONE-FILE-NOT: dir-with-filtering2.cpp | ||
|
||
RUN: FileCheck -input-file=%t.text_one_file/coverage/tmp/dir-with-filtering1.cpp.txt %s -check-prefix=TEXT-FILE1 | ||
|
||
// Test HTML both files | ||
|
||
RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata | ||
RUN: 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 | ||
|
||
RUN: FileCheck -input-file=%t.html/index.html %s -check-prefix=HTML-INDEX | ||
HTML-INDEX: <h2>Coverage Report</h2> | ||
HTML-INDEX: dir-with-filtering1.cpp{{.*}}100.00% (1/1){{.*}}100.00% (4/4){{.*}}100.00% (1/1) | ||
HTML-INDEX: dir-with-filtering2.cpp{{.*}}0.00% (0/1){{.*}}0.00% (0/3){{.*}}0.00% (0/1) | ||
|
||
RUN: FileCheck -input-file=%t.html/coverage/tmp/dir-with-filtering1.cpp.html %s -check-prefix=HTML-FILE1 | ||
HTML-FILE1-NOT: <pre>f1</pre> | ||
HTML-FILE1: <pre>main</pre> | ||
HTML-FILE1-NOT: <pre>f1</pre> | ||
HTML-FILE1: int main() | ||
HTML-FILE1-NOT: <pre>f1</pre> | ||
|
||
RUN: FileCheck -input-file=%t.html/coverage/tmp/dir-with-filtering2.cpp.html %s -check-prefix=HTML-FILE2 | ||
HTML-FILE2-NOT: <pre>f3</pre> | ||
HTML-FILE2: <pre>_Z2f2v</pre> | ||
HTML-FILE2-NOT: <pre>f3</pre> | ||
HTML-FILE2: int f2() | ||
HTML-FILE2-NOT: <pre>f3</pre> | ||
|
||
// Test HTML one file | ||
|
||
RUN: llvm-profdata merge %S/Inputs/dir-with-filtering.proftext -o %t.profdata | ||
RUN: 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 | ||
|
||
RUN: FileCheck -input-file=%t.html_one_file/index.html %s -check-prefix=HTML-INDEX-ONE-FILE | ||
HTML-INDEX-ONE-FILE: <h2>Coverage Report</h2> | ||
HTML-INDEX-ONE-FILE: dir-with-filtering1.cpp{{.*}}100.00% (1/1){{.*}}100.00% (4/4){{.*}}100.00% (1/1) | ||
HTML-INDEX-ONE-FILE-NOT: dir-with-filtering2.cpp | ||
|
||
RUN: FileCheck -input-file=%t.html_one_file/coverage/tmp/dir-with-filtering1.cpp.html %s -check-prefix=HTML-FILE1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.