summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-11-09 16:10:44 +0000
committerMax Moroz <mmoroz@chromium.org>2018-11-09 16:10:44 +0000
commitb2091c930b765a1f1b75c9159f49329af59604f9 (patch)
tree2cd9a18678670d2096029b255a7577c73dd29bb0 /llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test
parent9cad24a7ee2e61c21b24da6326827bb7dbb04dde (diff)
downloadbcm5719-llvm-b2091c930b765a1f1b75c9159f49329af59604f9.tar.gz
bcm5719-llvm-b2091c930b765a1f1b75c9159f49329af59604f9.zip
[llvm-cov] Add lcov tracefile export format.
Summary: lcov tracefiles are used by various coverage reporting tools and build systems (e.g., Bazel). It is a simple text-based format to parse and more convenient to use than the JSON export format, which needs additional processing to map regions/segments back to line numbers. It's a little unfortunate that "text" format is now overloaded to refer specifically to JSON for export, but I wanted to avoid making any breaking changes to the UI of the llvm-cov tool at this time. Patch by Tony Allevato (@allevato). Reviewers: Dor1s, vsk Reviewed By: Dor1s, vsk Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D54266 llvm-svn: 346506
Diffstat (limited to 'llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test')
-rw-r--r--llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test b/llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test
new file mode 100644
index 00000000000..9cacfb19eae
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts-lcov.test
@@ -0,0 +1,38 @@
+// FULL: SF:{{.*}}showLineExecutionCounts.cpp
+// FULL: FN:6,main
+// FULL: FNDA:161,main
+// FULL: FNF:1
+// FULL: FNH:1
+int main() { // FULL: DA:[[@LINE]],161
+ int x = 0; // FULL: DA:[[@LINE]],161
+ // FULL: DA:[[@LINE]],161
+ if (x) { // FULL: DA:[[@LINE]],161
+ x = 0; // FULL: DA:[[@LINE]],0
+ } else { // FULL: DA:[[@LINE]],161
+ x = 1; // FULL: DA:[[@LINE]],161
+ } // FULL: DA:[[@LINE]],161
+ // FULL: DA:[[@LINE]],161
+ for (int i = 0; i < 100; ++i) { // FULL: DA:[[@LINE]],16261
+ x = 1; // FULL: DA:[[@LINE]],16100
+ } // FULL: DA:[[@LINE]],16100
+ // FULL: DA:[[@LINE]],161
+ x = x < 10 ? x + 1 : x - 1; // FULL: DA:[[@LINE]],161
+ x = x > 10 ? // FULL: DA:[[@LINE]],161
+ x - 1: // FULL: DA:[[@LINE]],0
+ x + 1; // FULL: DA:[[@LINE]],161
+ // FULL: DA:[[@LINE]],161
+ return 0; // FULL: DA:[[@LINE]],161
+} // FULL: DA:[[@LINE]],161
+// FULL: LF:20
+// FULL: LH:18
+// FULL: end_of_record
+// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
+// RUN: llvm-cov export -format=lcov %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata %s | FileCheck -check-prefixes=FULL %s
+
+// RUN: llvm-cov export -format=lcov -summary-only %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata %s | FileCheck -check-prefixes=SUMMARYONLY %s
+// SUMMARYONLY: SF:{{.*}}showLineExecutionCounts.cpp
+// SUMMARYONLY: FNF:1
+// SUMMARYONLY: FNH:1
+// SUMMARYONLY: LF:20
+// SUMMARYONLY: LH:18
+// SUMMARYONLY: end_of_record
OpenPOWER on IntegriCloud