diff options
| author | Vedant Kumar <vsk@apple.com> | 2017-09-08 18:44:47 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2017-09-08 18:44:47 +0000 |
| commit | bae8397006fcb479bc9bcfe84e826bacbfbe7891 (patch) | |
| tree | 0c0ce2fffaaec799f50bf914d6f74ac9652b37af /llvm/test | |
| parent | 933b37f99f4f6f2ca3ab0d268caafc33c50bee84 (diff) | |
| download | bcm5719-llvm-bae8397006fcb479bc9bcfe84e826bacbfbe7891.tar.gz bcm5719-llvm-bae8397006fcb479bc9bcfe84e826bacbfbe7891.zip | |
[Coverage] Report errors when reading malformed source regions
Each source region has a start and end location. Report an error when
the end location does not precede the begin location.
The old lineExecutionCounts.covmapping test actually had a buggy source
region in it. This commit introduces a regenerated copy of the coverage
and moves the old copy to malformedRegions.covmapping, for a test.
Differential Revision: https://reviews.llvm.org/D37387
llvm-svn: 312814
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping | bin | 168 -> 180 bytes | |||
| -rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.json | 4 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-cov/Inputs/malformedRegions.covmapping | bin | 0 -> 168 bytes | |||
| -rw-r--r-- | llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp | 6 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-cov/warnings.h | 3 |
5 files changed, 8 insertions, 5 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping Binary files differindex 20d6abfffa7..f5ef388a733 100644 --- a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping +++ b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.covmapping diff --git a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.json b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.json index 7185d3fbf00..aaf1d9aa4e1 100644 --- a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.json +++ b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.json @@ -14,7 +14,7 @@ // CHECK-SAME: "summary":{ // CHECK-SAME: "lines":{"count":20,"covered":16,"percent":80}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, -// CHECK-SAME: "regions":{"count":10,"covered":7,"notcovered":3,"percent":70}}} +// CHECK-SAME: "regions":{"count":11,"covered":8,"notcovered":3,"percent":72}}} // Close Files Array // CHECK-SAME: ], @@ -33,7 +33,7 @@ // CHECK-SAME: "lines":{"count":20,"covered":16,"percent":80}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, -// CHECK-SAME: "regions":{"count":10,"covered":7,"notcovered":3,"percent":70}} +// CHECK-SAME: "regions":{"count":11,"covered":8,"notcovered":3,"percent":72}} // Close the export object, data array, and root object // CHECK-SAME: }]} diff --git a/llvm/test/tools/llvm-cov/Inputs/malformedRegions.covmapping b/llvm/test/tools/llvm-cov/Inputs/malformedRegions.covmapping Binary files differnew file mode 100644 index 00000000000..20d6abfffa7 --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/malformedRegions.covmapping diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp index 48460b3d2fd..ab0987ee756 100644 --- a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp +++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp @@ -50,7 +50,7 @@ int main() { // TEXT: [[@LINE]]| 161|int main( // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>int main() { // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> int x = 0 // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> -// HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> if (x) { +// HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> if (x) // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre><span class='red'> }</span> // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x = 1; @@ -62,7 +62,7 @@ int main() { // TEXT: [[@LINE]]| 161|int main( // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x = x < 10 // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x = x > 10 -// HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> x - 1: +// HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>x - 1</span>: // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> x + 1; // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> // HTML: <td class='line-number'><a name='L[[@LINE-44]]' href='#L[[@LINE-44]]'><pre>[[@LINE-44]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> return 0; @@ -91,5 +91,5 @@ int main() { // TEXT: [[@LINE]]| 161|int main( // HTML-INDEX: <td class='column-entry-yellow'> // HTML-INDEX: 80.00% (16/20) // HTML-INDEX: <td class='column-entry-red'> -// HTML-INDEX: 70.00% (7/10) +// HTML-INDEX: 72.73% (8/11) // HTML-INDEX: TOTALS diff --git a/llvm/test/tools/llvm-cov/warnings.h b/llvm/test/tools/llvm-cov/warnings.h index a7826e8bcc8..5bd62be6d04 100644 --- a/llvm/test/tools/llvm-cov/warnings.h +++ b/llvm/test/tools/llvm-cov/warnings.h @@ -11,3 +11,6 @@ // FAKE-FUNC-STDOUT-NOT: warning: Could not read coverage for '{{.*}}'. // FAKE-FUNC-STDERR: Could not read coverage for '{{.*}}'. + +// RUN: not llvm-cov report %S/Inputs/malformedRegions.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata 2>&1 | FileCheck %s -check-prefix=MALFORMED-REGION +// MALFORMED-REGION: malformedRegions.covmapping: Failed to load coverage: Malformed coverage data |

