summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-cov/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[Coverage] Revise format to reduce binary size"Vedant Kumar2019-12-041-0/+0
| | | | | | | | | | This reverts commit e18531595bba495946aa52c0a16b9f9238cff8bc. On Windows, there is an error: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/54963/steps/stage%201%20check/logs/stdio error: C:\b\slave\sanitizer-windows\build\stage1\projects\compiler-rt\test\profile\Profile-x86_64\Output\instrprof-merging.cpp.tmp.v1.o: Failed to load coverage: Malformed coverage data
* [Coverage] Revise format to reduce binary sizeVedant Kumar2019-12-041-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revise the coverage mapping format to reduce binary size by: 1. Naming function records and marking them `linkonce_odr`, and 2. Compressing filenames. This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB) and speeds up end-to-end single-threaded report generation by 10%. For reference the compressed name data in llc is 81MB (__llvm_prf_names). Rationale for changes to the format: - With the current format, most coverage function records are discarded. E.g., more than 97% of the records in llc are *duplicate* placeholders for functions visible-but-not-used in TUs. Placeholders *are* used to show under-covered functions, but duplicate placeholders waste space. - We reached general consensus about giving (1) a try at the 2017 code coverage BoF [1]. The thinking was that using `linkonce_odr` to merge duplicates is simpler than alternatives like teaching build systems about a coverage-aware database/module/etc on the side. - Revising the format is expensive due to the backwards compatibility requirement, so we might as well compress filenames while we're at it. This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB). See CoverageMappingFormat.rst for the details on what exactly has changed. Fixes PR34533 [2], hopefully. [1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html [2] https://bugs.llvm.org/show_bug.cgi?id=34533 Differential Revision: https://reviews.llvm.org/D69471
* Ignore object files that lack coverage information.James Y Knight2019-08-286-0/+6
| | | | | | | | | | Before this change, if multiple binary files were presented, all of them must have been instrumented or the load would fail with coverage_map_error::no_data_found. Patch by Dean Sturtevant. Differential Revision: https://reviews.llvm.org/D66763 llvm-svn: 370257
* [Coverage] Load code coverage data from archivesVedant Kumar2019-06-136-0/+10
| | | | | | | | | | | | | Support loading code coverage data from regular archives, thin archives, and from MachO universal binaries which contain archives. Testing: check-llvm, check-profile (with {A,UB}San enabled) rdar://51538999 Differential Revision: https://reviews.llvm.org/D63232 llvm-svn: 363325
* [llvm-cov] Add support for gcov --hash-filenames optionVedant Kumar2019-02-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The patch adds support for --hash-filenames to llvm-cov. This option adds md5 hash of the source path to the name of the generated .gcov file. The option is crucial for cases where you have multiple files with the same name but can't use --preserve-paths as resulting filenames exceed the limit. from gcov(1): ``` -x --hash-filenames By default, gcov uses the full pathname of the source files to to create an output filename. This can lead to long filenames that can overflow filesystem limits. This option creates names of the form source-file##md5.gcov, where the source-file component is the final filename part and the md5 component is calculated from the full mangled name that would have been used otherwise. ``` Patch by Igor Ignatev! Differential Revision: https://reviews.llvm.org/D58370 llvm-svn: 354379
* [gcov] Fix wrong line hit counts when multiple blocks are on the same lineCalixte Denizet2018-09-2012-24/+24
| | | | | | | | | | | | | | | | | | | | | Summary: The goal of this patch is to have the same behaviour than gcc-gcov. Currently the hit counts for a line is the sum of the counts for each block on that line. The idea is to detect the cycles in the graph of blocks in using the algorithm by Hawick & James. The count for a cycle is the min of the counts for each edge in the cycle. Once we've the count for each cycle, we can sum them and add the transition counts of those cycles. Fix both https://bugs.llvm.org/show_bug.cgi?id=38065 and https://bugs.llvm.org/show_bug.cgi?id=38066 Reviewers: marco-c, davidxl Reviewed By: marco-c Subscribers: vsk, lebedev.ri, sylvestre.ledru, dblaikie, llvm-commits Differential Revision: https://reviews.llvm.org/D49659 llvm-svn: 342657
* [llvm-cov] Delete custom JSON serialization code (NFC)Vedant Kumar2018-09-126-253/+31
| | | | | | | Teach llvm-cov to use the new llvm JSON library, and remove some redundant/brittle JSON serialization tests. llvm-svn: 342088
* [llvm-cov] Multi-threaded implementation of prepareFileReports method.Max Moroz2018-01-059-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Local testing has demonstrated a great speed improvement, compare the following: 1) Existing version: ``` $ time llvm-cov show -format=html -output-dir=report -instr-profile=... ... The tool has been launched: 00:00:00 Loading coverage data: 00:00:00 Get unique source files: 00:00:33 Creating an index out of the source files: 00:00:34 Going into prepareFileReports: 00:00:34 Going to emit summary information for each file: 00:28:55 <-- 28:21 min! Going to emit links to files with no function: 00:28:55 Launching 32 threads for generating HTML files: 00:28:55 real 37m43.651s user 112m5.540s sys 7m39.872s ``` 2) Multi-threaded version with 32 CPUs: ``` $ time llvm-cov show -format=html -output-dir=report -instr-profile=... ... The tool has been launched: 00:00:00 Loading coverage data: 00:00:00 Get unique source files: 00:00:38 Creating an index out of the source files: 00:00:40 Going into prepareFileReports: 00:00:40 Preparing file reports using 32 threads: 00:00:40 # Creating thread tasks for the following number of files: 16422 Going to emit summary information for each file: 00:01:57 <-- 1:17 min! Going to emit links to files with no function: 00:01:58 Launching 32 threads for generating HTML files: 00:01:58 real 11m2.044s user 134m48.124s sys 7m53.388s ``` Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: Dor1s, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D41206 llvm-svn: 321871
* [llvm-cov] Fix more -path-equivalence test bugsVedant Kumar2017-11-092-0/+0
| | | | llvm-svn: 317764
* [Coverage] Use the wrapped segment when a line has entry segmentsVedant Kumar2017-11-0910-15/+13
| | | | | | | | | We've worked around bugs in the frontend by ignoring the count from wrapped segments when a line has at least one region entry segment. Those frontend bugs are now fixed, so it's time to regenerate the checked-in covmapping files and remove the workaround. llvm-svn: 317761
* [llvm-cov] Remove workaround in line execution count calculation (PR34962)Vedant Kumar2017-10-162-0/+0
| | | | | | | | | | | | | Gap areas make it possible to correctly determine when to use counts from deferred regions. Before gap areas were introduced, llvm-cov needed to use a heuristic to do this: it ignored counts from segments that start, but do not end, on a line. This heuristic breaks down on a simple example (see PR34962). This patch removes the heuristic and picks counts from any region entry segment which isn't a gap area. llvm-svn: 315960
* [llvm-cov] Reland sources-specified.test with addition of "-path-equivalence".Max Moroz2017-10-131-0/+0
| | | | | | | | | | | | Summary: This version of tests should be working properly. Reviewers: vsk Reviewed By: vsk Differential Revision: https://reviews.llvm.org/D38889 llvm-svn: 315714
* [llvm-cov] Generate "report" for given source paths if sources are specified.Max Moroz2017-10-136-0/+20
| | | | | | | | | | | | | | | | Summary: Documentation says that user can specify sources for both "show" and "report" commands. "Show" command respects specified sources, but "report" does not. It is useful to have both "show" and "report" generated for specified sources. Also added tests to for both commands with sources specified. Reviewers: vsk, kcc Reviewed By: vsk Differential Revision: https://reviews.llvm.org/D38860 llvm-svn: 315685
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-284-0/+48
| | | | | | | | | | | 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
* Revert "[llvm-cov] Create directory structure when filtering using -name*= ↵Sean Eveson2017-09-274-48/+0
| | | | | | | | options" Test failures. llvm-svn: 314314
* [llvm-cov] Create directory structure when filtering using -name*= optionsSean Eveson2017-09-274-0/+48
| | | | | | | | | | | 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: 314310
* [llvm-cov] Make report metrics agree with line exec counts, fixes PR34615Vedant Kumar2017-09-194-8/+8
| | | | | | | | | Use the same logic as the line-oriented coverage view to determine the number of covered lines in a function. Fixes llvm.org/PR34615. llvm-svn: 313604
* [Coverage] Use gap regions to select better line exec countsVedant Kumar2017-09-181-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | After clang started emitting deferred regions (r312818), llvm-cov has had a hard time picking reasonable line execuction counts. There have been one or two generic improvements in this area (e.g r310012), but line counts can still report coverage for whitespace instead of code (llvm.org/PR34612). To fix the problem: * Introduce a new region kind so that frontends can explicitly label gap areas. This is done by changing the encoding of the columnEnd field of MappingRegion. This doesn't substantially increase binary size, and makes it easy to maintain backwards-compatibility. * Don't set the line count to a count from a gap area, unless the count comes from a wrapped segment. * Don't highlight gap areas as uncovered. Fixes llvm.org/PR34612. llvm-svn: 313597
* [llvm-cov] Avoid over-counting covered lines and regionsVedant Kumar2017-09-156-0/+63
| | | | | | | | | | | | | | | | * Fix an unsigned integer overflow in the logic that computes the number of uncovered lines in a function. * When aggregating region and line coverage summaries, take into account that different instantiations may have a different number of regions. The new test case provides test coverage for both bugs. I also verified this change by preparing a coverage report for a stage2 build of llc -- the new assertions should detect any outstanding over-counting bugs. Fixes PR34613. llvm-svn: 313417
* [llvm-cov] Don't attach exec counts to lines which start a skipped regionVedant Kumar2017-09-112-0/+0
| | | | | | | | | These lines by definition don't have an execution count. This is the final part of the fix for: https://bugs.llvm.org/show_bug.cgi?id=34166 llvm-svn: 312955
* [llvm-cov] Disable name-compression in a test binaryVedant Kumar2017-09-081-0/+0
| | | | | | | | | | This should fix the lld bot: The Buildbot has detected a new failure on builder llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast while building cfe. Full details are available at: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/16993 llvm-svn: 312821
* [Coverage] Report errors when reading malformed source regionsVedant Kumar2017-09-083-2/+2
| | | | | | | | | | | | | 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
* [llvm-cov] Read in function names for filtering from a text file.Sean Eveson2017-08-315-0/+80
| | | | | | | | | | | | | | Summary: Add a -name-whitelist option, which behaves in the same way as -name, but it reads in multiple function names from the given input file(s). Reviewers: vsk Reviewed By: vsk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37111 llvm-svn: 312227
* [llvm-cov] Add an option which maps the location of source directories on ↵Sean Eveson2017-08-142-0/+8
| | | | | | | | | | | | | | | | | | | another machine to your local copies Summary: This patch adds the -path-equivalence option (example: llvm-cov show -path-equivalence=/origin/path,/local/path) which maps the source code path from one machine to another when using `llvm-cov show`. This is similar to the -filename-equivalence option, but doesn't require you to specify all the source files on the command line. This allows you to generate the coverage data on one machine (e.g. in a CI system), and then use llvm-cov on another machine where you have the same code base on a different path. Reviewers: vsk Reviewed By: vsk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36391 llvm-svn: 310827
* [llvm-cov] Ignore unclosed line segments when setting line countsVedant Kumar2017-08-042-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes a slight change to the way llvm-cov determines line execution counts. If there are multiple line segments on a line, the line count is the max count among the regions which start *and* end on the line. This avoids an issue posed by deferred regions which start on the same line as a terminated region, e.g: if (false) return; //< The line count should be 0, even though a new region //< starts at the semi-colon. foo(); Another change is that counts from line segments which don't correspond to region entries are considered. This enables the first change, and corrects an outstanding issue (see the showLineExecutionCounts.cpp test change). This is related to D35925. Testing: check-profile, llvm-cov lit tests Differential Revision: https://reviews.llvm.org/D36014 llvm-svn: 310012
* [gcov] Sort file info before printing itVedant Kumar2017-04-2610-45/+45
| | | | | | | | | | | | | The order in which GCOV file info is printed depends on the string hash function. This makes some GCOV tests brittle, because the tests must be updated whenever the hash function changes. Sort the filenames before printing out the file info to solve the problem. This should be relatively cheap. Differential Revision: https://reviews.llvm.org/D32512 llvm-svn: 301371
* [llvm-cov] Strip redundant path components from filenames (fix PR31982)Vedant Kumar2017-02-231-0/+0
| | | | | | | | | Instead of stripping the longest common prefix off of the filenames in a report, strip out the longest chain of redundant path components. This fixes the case in PR31982, where there are two files with the same prefix, and stripping out the LCP makes things less intelligible. llvm-svn: 296029
* [llvm-cov] Avoid 0% when reporting something that's 0/0Alex Lorenz2016-11-213-0/+19
| | | | | | | | | | | | | This commit makes llvm-cov avoid showing 0% (0/0) coverage for things like file function coverage, etc. in reports and HTML output. This can happen for files like headers that have macros but no functions. This commit makes llvm-cov report - (0/0) instead. rdar://29246480 Differential Revision: https://reviews.llvm.org/D26615 llvm-svn: 287539
* [llvm-cov] Do not print out the filename of the object fileVedant Kumar2016-10-257-14/+13
| | | | | | | | | When we load coverage data from multiple objects, we don't have a way to attribute a source object to a function record. Printing out the object filename next to the source filename is already not very useful: soon, it'll actually become misleading. Stop printing out the filename now. llvm-svn: 285043
* [llvm-cov] Delete the NonCodeLines field, it was always deadVedant Kumar2016-09-196-18/+18
| | | | llvm-svn: 281882
* [llvm-cov] Teach the coverage exporter about instantiation coverageVedant Kumar2016-09-196-0/+6
| | | | | | | While we're at it, re-use the logic from CoverageReport to compute summaries. llvm-svn: 281877
* [llvm-cov] Track function and instantiation coverage separatelyVedant Kumar2016-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | These are distinct statistics which are useful to look at separately. Example: say you have a template function "foo" with 5 instantiations and only 3 of them are covered. Then this contributes (1/1) to the total function coverage and (3/5) to the total instantiation coverage. I.e, the old "Function Coverage" column has been renamed to "Instantiation Coverage", and the new "Function Coverage" aggregates information from the various instantiations of a function. One benefit of making this switch is that the Line and Region coverage columns will start making sense. Let's continue the example and assume that the 5 instantiations of "foo" cover {2, 4, 6, 8, 10} out of 10 lines respectively. The new line coverage for "foo" is (10/10), not (30/50). The old scenario got confusing because we'd report that there were more lines in a file than what was actually possible. llvm-svn: 281875
* [llvm-cov] Drop another redundant 'No.' suffixVedant Kumar2016-09-191-1/+1
| | | | llvm-svn: 281872
* [llvm-cov] Hide instantiation views for unexecuted functionsVedant Kumar2016-09-151-0/+16
| | | | | | | | Copying in the full text of the function doesn't help at all when we already know that it's never executed. Just say that it's unexecuted -- the relevant source text has already been printed. llvm-svn: 281589
* [llvm-cov] Don't print a verbose title when looking at one fileVedant Kumar2016-09-151-2/+2
| | | | | | | Having the same title, timestamp, etc. occur repeatedly creates an unnecessary distraction when paging through a report. llvm-svn: 281579
* [llvm-cov] Fix tests that aren't checking anything (NFC)Vedant Kumar2016-09-151-0/+16
| | | | | | | E.g the 'showProjectSummary' test contains some checks which can't fail because they match themselves... llvm-svn: 281578
* [llvm-cov] Disable zlib compression in a test input, unbreaks botsVedant Kumar2016-09-081-0/+0
| | | | | | | | | | Disable name compression in the inputs used to produce multiple-files.covmapping. Should fix bots which don't compile with zlib: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/19610/steps/test/logs/stdio llvm-svn: 280898
* [llvm-cov] Drop the longest common filename prefix from summariesVedant Kumar2016-09-082-0/+19
| | | | | | | Remove the longest common prefix from filenames when printing coverage summaries. This makes them easier to compare. llvm-svn: 280895
* [llvm-cov] Use the native path in the coverage report.Ying Yi2016-08-301-0/+0
| | | | | | | | | | | The coverage reports contain the source or binary file paths. On Windows, the file path might contain the seperators of both '/' and '\'. This patch uses the native path in the coverage reports. For example, on Windows, all '/' are converted to '\'. Differential Revision: https://reviews.llvm.org/D23922 llvm-svn: 280061
* [llvm-cov] Add the project summary to each source file coverage report.Ying Yi2016-08-242-0/+10
| | | | | | | | | | | | This patch includes the following changes: - Included header "Code coverage report" and include the date that the report was created. - Included title (as specified in a command line option, (i.e llvm-cov -project-title="Simple Test") - In the summary, list the elf files that the source code file has contributed to. - Used column heading for "Line No.", "Count No.", Source". Differential Revision: https://reviews.llvm.org/D23345 llvm-svn: 279628
* [llvm-cov] Swapped the line and count columns.Ying Yi2016-08-091-8/+8
| | | | | | | | | In the coverage report, the line and count columns have been swapped to make it more readable. A follow-up commit in compiler-rt is needed Differential Revision: https://reviews.llvm.org/D23281 llvm-svn: 278152
* [LLVM-COV]Replace tabs to the space indentations in the HTML coverage report.Ying Yi2016-08-042-0/+8
| | | | | | | | | | | When using orbis-llvm-cov.exe to generate the HTML report, the HTML report can look quite different to the source file if it includes tabs.The default tab size is 2 spaces instead of 8 spaces. A command line switch is be added to set the tab size. Differential Revision: https://reviews.llvm.org/D23087 llvm-svn: 277715
* Retry: [llvm-cov] Add support for exporting coverage data to JSONVedant Kumar2016-07-266-0/+253
| | | | | | | | | | | | | | | | | | | | | | | | This enables users to export coverage information as portable JSON for use by analysis tools and storage in document based databases. The export sub-command is invoked just like the others: llvm-cov export -instr-profile path/to/foo.profdata path/to/foo.binary The resulting JSON contains a list of files and functions. Every file object contains a list of segments, expansions, and a summary of the file's region, function, and line coverage. Every function object contains the function's name and regions. There is also a total summary for the entire object file. Changes since the initial commit (r276813): - Fixed the regexes in the tests to handle Windows filepaths. Patch by Eddie Hurtig! Differential Revision: https://reviews.llvm.org/D22651 llvm-svn: 276818
* Revert "[llvm-cov] Add support for exporting coverage data to JSON"Vedant Kumar2016-07-266-253/+0
| | | | | | | | | This reverts commit r276813. The Windows bots are complaining about some of the filename regexes in the tests: http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/5299 llvm-svn: 276816
* [llvm-cov] Add support for exporting coverage data to JSONVedant Kumar2016-07-266-0/+253
| | | | | | | | | | | | | | | | | | | | This enables users to export coverage information as portable JSON for use by analysis tools and storage in document based databases. The export sub-command is invoked just like the others: llvm-cov export -instr-profile path/to/foo.profdata path/to/foo.binary The resulting JSON contains a list of files and functions. Every file object contains a list of segments, expansions, and a summary of the file's region, function, and line coverage. Every function object contains the function's name and regions. There is also a total summary for the entire object file. Patch by Eddie Hurtig! Differential Revision: https://reviews.llvm.org/D22651 llvm-svn: 276813
* [llvm-cov] Disable PGO name compression in a test fileVedant Kumar2016-06-291-0/+0
| | | | | | | | Some bots do not configure llvm with zlib enabled. Should fix: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/15571 llvm-svn: 274137
* [llvm-cov] Do not allow ".." to escape the coverage sub-directoryVedant Kumar2016-06-292-0/+8
| | | | | | | | | | | In -output-dir mode, file reports are placed into a "coverage" directory. If filenames in the coverage mapping contain "..", they might escape out of this directory. Fix the problem by removing ".." from source filenames (expand the path component). llvm-svn: 274135
* [Coverage] Fix an issue where improper coverage mapping data could be loaded ↵Igor Kudrin2016-05-203-0/+30
| | | | | | | | | | | | | | for an inline function. If an inline function is observed but unused in a translation unit, dummy coverage mapping data with zero hash is stored for this function. If such a coverage mapping section came earlier than real one, the latter was ignored. As a result, llvm-cov was unable to show coverage information for those functions. Differential Revision: http://reviews.llvm.org/D20286 llvm-svn: 270194
* [Coverage] Ensure that coverage mapping data has an expected alignment in ↵Igor Kudrin2016-05-187-0/+0
| | | | | | | | | | | | | 'covmapping' files. Coverage mapping data is organized in a sequence of blocks, each of which is expected to be aligned by 8 bytes. This feature is used when reading those blocks, see VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge mapping data has more than one block, it causes llvm-cov to fail. Differential Revision: http://reviews.llvm.org/D20285 llvm-svn: 269887
* [Coverage] Combine counts of expansion regions if there are no code regions ↵Igor Kudrin2016-05-052-0/+8
| | | | | | | | for the same area. Differential Revision: http://reviews.llvm.org/D18831 llvm-svn: 268620
OpenPOWER on IntegriCloud