summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-07-06 21:44:05 +0000
committerVedant Kumar <vsk@apple.com>2016-07-06 21:44:05 +0000
commit4c01092a25506abfc75e36ce625cf0c2c3446ddc (patch)
treecea51e9b3f76a813b73086b89f1d6a36d0640544 /llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
parentd03e659140834cd2a50087bf0e5bc5ffca70b2f4 (diff)
downloadbcm5719-llvm-4c01092a25506abfc75e36ce625cf0c2c3446ddc.tar.gz
bcm5719-llvm-4c01092a25506abfc75e36ce625cf0c2c3446ddc.zip
[llvm-cov] Add support for creating html reports
Based on a patch by Harlan Haskins! Differential Revision: http://reviews.llvm.org/D18278 llvm-svn: 274688
Diffstat (limited to 'llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp')
-rw-r--r--llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
index b8ccdd4aa3e..c624c147820 100644
--- a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
+++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
@@ -38,3 +38,34 @@ int main() { // TEXT: 161| [[@LINE]]|int main(
// Test index creation.
// RUN: FileCheck -check-prefix=INDEX -input-file %t.dir/index.txt %s
// INDEX: showLineExecutionCounts.cpp.txt
+//
+// Test html output.
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.html.dir -instr-profile %t.profdata -filename-equivalence %s
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.html.dir -instr-profile %t.profdata -filename-equivalence -name=main %s
+// RUN: FileCheck -check-prefixes=HTML,HTML-WHOLE-FILE -input-file %t.html.dir/coverage/tmp/showLineExecutionCounts.cpp.html %s
+// RUN: FileCheck -check-prefixes=HTML,HTML-FILTER -input-file %t.html.dir/functions.html %s
+//
+// HTML-WHOLE-FILE: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>// before
+// HTML-FILTER-NOT: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-45]]</pre></td><td class='code'><pre>// before
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>int main() {
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> int x = 0
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>
+// HTML: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre><span class='red'> if (x) {
+// HTML: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre><span class='red'> }</span>
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> x = 1;
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> }
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>
+// HTML: <td class='covered-line'><pre>16.2k</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> for (int i = 0; i &lt; 100; ++i)
+// HTML: <td class='covered-line'><pre>16.1k</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> x = 1;
+// HTML: <td class='covered-line'><pre>16.1k</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> }
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> x = x &lt; 10
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> x = x &gt; 10
+// HTML: <td class='uncovered-line'><pre>0</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre><span class='red'> x - 1:
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> x + 1;
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre> return 0;
+// HTML: <td class='covered-line'><pre>161</pre></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>}
+// HTML-WHOLE-FILE: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-44]]</pre></td><td class='code'><pre>// after
+// HTML-FILTER-NOT: <td class='uncovered-line'></td><td class='line-number'><pre>[[@LINE-45]]</pre></td><td class='code'><pre>// after
OpenPOWER on IntegriCloud